Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330589

Summary: [3.6.x] Exception when disposing a menu
Product: [Eclipse Project] Platform Reporter: Scott Kovatch <skovatch>
Component: SWTAssignee: Scott Kovatch <skovatch>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: aristide.martin, lshanmug, mariot.chauvin, pwebster, remy.suen, skovatch
Version: 3.6.2Flags: skovatch: review? (Silenio_Quarti)
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Bug Depends on: 329924    
Bug Blocks:    

Description Scott Kovatch CLA 2010-11-18 11:57:51 EST
Cloning for a 3.6.x fix.

+++ This bug was initially created as a clone of Bug #329924 +++

Build Identifier: M20100211-1343

Here is the stacktrace:
Daemon Thread [Thread-0] (Suspended (exception SWTException))	
	SWT.error(int, Throwable, String) line: 3886	
	SWT.error(int, Throwable) line: 3799	
	SWT.error(int) line: 3770	
	Menu(Widget).error(int) line: 619	
	Menu(Widget).checkWidget() line: 462	
	Menu(Widget).getStyle() line: 805	
	MenuItem.updateText() line: 775	
	MenuItem.setMenu(Menu) line: 683	
	Menu.releaseParent() line: 725	
	Menu(Widget).release(boolean) line: 1116	
	Menu(Widget).dispose() line: 544	
	ActionMenuManager$MenuCreatorAction.dispose() line: 122	
	ActionContributionItem.handleWidgetDispose(Event) line: 474	
	ActionContributionItem.access$1(ActionContributionItem, Event) line: 466	
	ActionContributionItem$5.handleEvent(Event) line: 406	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 3543	
	MenuItem(Widget).sendEvent(Event) line: 1250	
	MenuItem(Widget).sendEvent(int, Event, boolean) line: 1273	
	MenuItem(Widget).sendEvent(int) line: 1254	
	MenuItem(Widget).release(boolean) line: 1108	
	MenuItem(Widget).dispose() line: 544	
	ActionContributionItem.dispose() line: 1191	
	ArrowTypeTargetMenuManager(ActionMenuManager).dispose() line: 317	
	AbstractContributionItemProvider$PluginMenuManager.dispose() line: 1106	
	SubContributionItem.dispose() line: 51	
	ArrowTypeMenuManager(MenuManager).dispose() line: 234	
	ArrowTypeMenuManager(ActionMenuManager).dispose() line: 318	
	ActionMenuManager$MenuCreatorAction.dispose() line: 126	
	ActionContributionItem.handleWidgetDispose(Event) line: 474	
	ActionContributionItem.access$1(ActionContributionItem, Event) line: 466	
	ActionContributionItem$5.handleEvent(Event) line: 406	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 3543	
	MenuItem(Widget).sendEvent(Event) line: 1250	
	MenuItem(Widget).sendEvent(int, Event, boolean) line: 1273	
	MenuItem(Widget).sendEvent(int) line: 1254	
	MenuItem(Widget).release(boolean) line: 1108	
	Menu.releaseChildren(boolean) line: 709	
	Menu(Widget).release(boolean) line: 1111	
	MenuItem.releaseChildren(boolean) line: 417	
	MenuItem(Widget).release(boolean) line: 1111	
	MenuItem(Widget).dispose() line: 544	
	MenuManager.update(boolean, boolean) line: 784	
	MenuManager.update(boolean) line: 678	
	WorkbenchWindow.updateActionBars() line: 3155	
	WorkbenchPage.updateActionBars() line: 3994	
	WorkbenchPage$ActionSwitcher.updateTopEditor(IEditorPart) line: 428	
	WorkbenchPage.makeActiveEditor(IEditorReference) line: 1271	
	WorkbenchPage.updateActivePart() line: 1222	
	WorkbenchPage.handleDeferredEvents() line: 1417	
	WorkbenchPage.deferUpdates(boolean) line: 1406	
	WorkbenchPage.closeEditors(IEditorReference[], boolean) line: 1380	
	WorkbenchPage.closeEditor(IEditorPart, boolean) line: 1444	
	DiagramDocumentEditor$4.run() line: 498	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 3405	
	Display.readAndDispatch() line: 3102	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2405	
	Workbench.runUI() line: 2369	
	Workbench.access$4(Workbench) line: 2221	
	Workbench$5.run() line: 500	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 113	
	UITestApplication.start(IApplicationContext) line: 54	
	EclipseAppHandle.run(Object) line: 194	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 368	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 559	
	Main.basicRun(String[]) line: 514	
	Main.run(String[]) line: 1311	
	Main.main(String[]) line: 1287	

Reproducible: Sometimes

Steps to Reproduce:
We have got this problem on an gmf editor, while a functional testing which close and open the editor.
Comment 1 Scott Kovatch CLA 2010-12-03 12:27:11 EST
Fix is to add 

	/* Update menu title with parent item title */
	if (!parent.isDisposed()) updateText ();

instead of an unchecked call to updateText() at the end of MenuItem#setMenu().

Requesting review for 3.6.2, so there's no rush to review.
Comment 2 Silenio Quarti CLA 2010-12-06 17:07:11 EST
This patch did not made sense to me. How can the parent of a menu item be disposed while the menu item itself is not disposed? It seems there is something else wrong in the dispose cycle and the patch is just hiding it.

Are you able to reproduce it?
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:07:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 4 Lakshmi P Shanmugam CLA 2020-06-25 03:33:54 EDT
This has been fixed in 3.7 via Bug 329924. Closing the backport bug.