Community
Participate
Working Groups
Follow up on bug 420956 (see discussion on the patch https://git.eclipse.org/r/40448). It looks like created CommandContributionItem instances are never disposed in 4.x (I'm on 4.5 M5 + HEAD changes). They seem not to be disposed neither in CPD nor on creating & closing new window. My naive attempt to dispose them (see diff below) failed because the corresponding toolbar buttons disappeared after opening/closing CPD dialog. diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java index af4e3c9..8a6b9a2 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarToTrimManager.java @@ -295,6 +295,10 @@ if (OpaqueElementUtil.isOpaqueToolItem(element)) { toRemove.add(element); } + IContributionItem ci = renderer.getContribution(element); + if (ci != null) { + ci.dispose(); + } } if (!toRemove.isEmpty()) { toolbar.getChildren().removeAll(toRemove); In Eclipse 3.8 they are disposed for example in this call tree: Thread [main] (Suspended (breakpoint at line 762 in CommandContributionItem)) CommandContributionItem.dispose() line: 762 ToolBarManager.dispose() line: 159 ToolBarContributionItem2(ToolBarContributionItem).dispose() line: 162 CoolBarManager.dispose() line: 270 CustomizePerspectiveDialog$CustomizeActionBars.dispose() line: 1406 CustomizePerspectiveDialog.close() line: 3235 CustomizePerspectiveDialog(Dialog).cancelPressed() line: 488 CustomizePerspectiveDialog(Dialog).buttonPressed(int) line: 474 Dialog$2.widgetSelected(SelectionEvent) line: 624 TypedListener.handleEvent(Event) line: 248 EventTable.sendEvent(Event) line: 84 Button(Widget).sendEvent(Event) line: 1053 Display.runDeferredEvents() line: 4169 Display.readAndDispatch() line: 3758 CustomizePerspectiveDialog(Window).runEventLoop(Shell) line: 825 CustomizePerspectiveDialog(Window).open() line: 801 WorkbenchPage.editActionSets() line: 1970 EditActionSetsHandler.execute(ExecutionEvent) line: 41 HandlerProxy.execute(ExecutionEvent) line: 290 Command.executeWithChecks(ExecutionEvent) line: 499 ParameterizedCommand.executeWithChecks(Object, Object) line: 508 HandlerService.executeCommand(ParameterizedCommand, Event) line: 169 SlaveHandlerService.executeCommand(ParameterizedCommand, Event) line: 241 ActionFactory$WorkbenchCommandAction(CommandAction).runWithEvent(Event) line: 157 ActionContributionItem.handleWidgetSelection(Event, boolean) line: 584 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 501 ActionContributionItem$5.handleEvent(Event) line: 411 EventTable.sendEvent(Event) line: 84 MenuItem(Widget).sendEvent(Event) line: 1053 Display.runDeferredEvents() line: 4169 Display.readAndDispatch() line: 3758 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2700 Workbench.runUI() line: 2664 Workbench.access$4(Workbench) line: 2498 Workbench$7.run() line: 679 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 668 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 124 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 353 EclipseStarter.run(String[], Runnable) line: 180 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 606 Main.invokeFramework(String[], URL[]) line: 629 Main.basicRun(String[]) line: 584 Main.run(String[]) line: 1438 Main.main(String[]) line: 1414 Is this a bug or feature???
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. -- The automated Eclipse Genie.
I think this is a bug, all should be cleaned up when removed from a parent. The disappearance of toolbar items in your naive approach is probably related to Bug 549898