Project: Eclipse_Platform_UI
Bug 249502 [Coolbar] init is called during dispose of a IWorkbenchWindowPulldownDelegate2
Reported: 2008-10-02 10:57:51 | Status: verified fixed

Build ID: M20080911-1700 Steps To Reproduce: 1. contribute a IWorkbenchWindowPulldownDelegate2 with some options 2. Open the workbench, and open a new workbench window (Window -> new Window) 3. You will now hit a break point in the init method of the IWorkbenchWindowPulldownDelegate2. 4. Select the pulldown, and select some option (This seems to be important, if I don't drop the menu and use something, it doesn't happen ... causes the menu to be created maybe?) 5. close the window -> dispose is called -> init is called again! This is bad since we have code for registering listeners etc during the init method. In this case we have removed our listeners in the dispose, but then re-register them before the window is actually closed. More information: Here's a trace of the shut down leading to the re-initialization of the delegate. Thread [main] (Suspended (breakpoint at line 67 in ChangeLanguageToolbarAction)) ChangeLanguageToolbarAction.init(IWorkbenchWindow) line: 67 WWinPluginPulldown(WWinPluginAction).initDelegate() line: 189 WWinPluginPulldown(PluginAction).createDelegate() line: 125 WWinPluginPulldown(PluginAction).getMenuCreator() line: 380 PluginActionCoolBarContributionItem(ActionContributionItem).handleWidgetDispose(Event) line: 471 ActionContributionItem.access$1(ActionContributionItem, Event) line: 465 ActionContributionItem$6.handleEvent(Event) line: 446 EventTable.sendEvent(Event) line: 84 ToolItem(Widget).sendEvent(Event) line: 1003 ToolItem(Widget).sendEvent(int, Event, boolean) line: 1027 ToolItem(Widget).sendEvent(int) line: 1008 ToolItem(Widget).release(boolean) line: 804 ToolBar.releaseChildren(boolean) line: 710 ToolBar(Widget).release(boolean) line: 807 CoolBar(Composite).releaseChildren(boolean) line: 755 CoolBar.releaseChildren(boolean) line: 713 CoolBar(Widget).release(boolean) line: 807 Composite.releaseChildren(boolean) line: 755 Composite(Widget).release(boolean) line: 807 CBanner(Composite).releaseChildren(boolean) line: 755 CBanner(Widget).release(boolean) line: 807 Shell(Composite).releaseChildren(boolean) line: 755 Shell(Canvas).releaseChildren(boolean) line: 174 Shell(Decorations).releaseChildren(boolean) line: 771 Shell.releaseChildren(boolean) line: 1211 Shell(Widget).release(boolean) line: 807 Shell(Widget).dispose() line: 441 Shell(Decorations).dispose() line: 446 Shell.dispose() line: 674 WorkbenchWindow(Window).close() line: 335 WorkbenchWindow(ApplicationWindow).close() line: 306 WorkbenchWindow.hardClose() line: 1624 WorkbenchWindow.busyClose() line: 722 WorkbenchWindow.access$0(WorkbenchWindow) line: 698 WorkbenchWindow$3.run() line: 814 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchWindow.close() line: 812 WorkbenchWindow(Window).handleShellCloseEvent() line: 741 Window$3.shellClosed(ShellEvent) line: 687 TypedListener.handleEvent(Event) line: 92 EventTable.sendEvent(Event) line: 84 Shell(Widget).sendEvent(Event) line: 1003 Shell(Widget).sendEvent(int, Event, boolean) line: 1027 Shell(Widget).sendEvent(int, Event) line: 1012 Shell(Decorations).closeWidget() line: 307 Shell(Decorations).WM_CLOSE(int, int) line: 1643 Shell(Control).windowProc(int, int, int, int) line: 3789 Shell(Canvas).windowProc(int, int, int, int) line: 337 Shell(Decorations).windowProc(int, int, int, int) line: 1576 Shell.windowProc(int, int, int, int) line: 1937 Display.windowProc(int, int, int, int) line: 4528 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2366 Shell.callWindowProc(int, int, int, int) line: 477 Shell(Control).windowProc(int, int, int, int) line: 3877 Shell(Canvas).windowProc(int, int, int, int) line: 337 Shell(Decorations).windowProc(int, int, int, int) line: 1576 Shell.windowProc(int, int, int, int) line: 1937 Display.windowProc(int, int, int, int) line: 4528 OS.DefWindowProcW(int, int, int, int) line: not available [native method] OS.DefWindowProc(int, int, int, int) line: 2366 Shell.callWindowProc(int, int, int, int) line: 477 Shell(Control).windowProc(int, int, int, int) line: 3877 Shell(Canvas).windowProc(int, int, int, int) line: 337 Shell(Decorations).windowProc(int, int, int, int) line: 1576 Shell.windowProc(int, int, int, int) line: 1937 Display.windowProc(int, int, int, int) line: 4528 OS.DispatchMessageW(MSG) line: not available [native method] OS.DispatchMessage(MSG) line: 2371 Display.readAndDispatch() line: 3420 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2382 Workbench.runUI() line: 2346 Workbench.access$4(Workbench) line: 2198 Workbench$5.run() line: 493 Realm.runWithDefault(Realm, Runnable) line: 288 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 113 EclipseAppHandle.run(Object) line: 193 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 386 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 59 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 39 Method.invoke(Object, Object...) line: 612 Main.invokeFramework(String[], URL[]) line: 549 Main.basicRun(String[]) line: 504 Main.run(String[]) line: 1236 Main.main(String[]) line: 1212

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java