Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339877 - ToolBarManagerRenderer should not dispose of items that weren't created by the rendering engine
Summary: ToolBarManagerRenderer should not dispose of items that weren't created by th...
Status: VERIFIED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.1 M7   Edit
Assignee: Remy Suen CLA
QA Contact: Remy Suen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 08:41 EDT by Remy Suen CLA
Modified: 2011-04-26 10:16 EDT (History)
1 user (show)

See Also:


Attachments
ToolBarManagerRenderer patch v1 (1.93 KB, patch)
2011-03-14 09:50 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-03-14 08:41:13 EDT
1. Window > Open Perspective > CVS Repository Exploring
2. The 'CVS Repositories' view doesn't have the 'Add CVS Repository' tool item.
3. Resizing the view doesn't help.
4. Close the view.
5. Reopen it.
6. Now it's there. Or maybe not, it didn't come back for Paul anyway.
Comment 1 Remy Suen CLA 2011-03-14 08:42:54 EDT
The workaround is to use the context menu to add it instead (if it never comes back for you).
Comment 2 Remy Suen CLA 2011-03-14 09:15:32 EDT
This is where the item gets disposed.

Thread [main] (Suspended (breakpoint at line 433 in ToolItem))	
	ToolItem.releaseWidget() line: 433	
	ToolItem(Widget).release(boolean) line: 817	
	ToolItem(Widget).dispose() line: 446	
	ToolBarManagerRenderer.hideChild(MElementContainer<MUIElement>, MUIElement) line: 709	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 647	
	PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 636	
	PartRenderingEngine$6.run() line: 631	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 616	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 662	
	PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 636	
	PartRenderingEngine$6.run() line: 631	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 616	
	PerspectiveStackRenderer(LazyStackRenderer).showElementRecursive(MUIElement, List<MUIElement>) line: 265	
	PerspectiveStackRenderer(LazyStackRenderer).showElementRecursive(MUIElement, List<MUIElement>) line: 330	
	PerspectiveStackRenderer(LazyStackRenderer).showElementRecursive(MUIElement, List<MUIElement>) line: 336	
	PerspectiveStackRenderer(LazyStackRenderer).showElementRecursive(MUIElement, List<MUIElement>) line: 336	
	PerspectiveStackRenderer(LazyStackRenderer).showTab(MUIElement) line: 144	
	PerspectiveStackRenderer.showTab(MUIElement) line: 109	
	LazyStackRenderer$1.handleEvent(Event) line: 73	
	UIEventHandler$1.run() line: 41	
	UISynchronizer(Synchronizer).syncExec(Runnable) line: 179	
	UISynchronizer.syncExec(Runnable) line: 150	
	Display.syncExec(Runnable) line: 4668	
	E4Application$1.syncExec(Runnable) line: 172	
	UIEventHandler.handleEvent(Event) line: 38	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 197	
	EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197	
	EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1	
	EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230	
	ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148	
	EventAdminImpl.dispatchEvent(Event, boolean) line: 135	
	EventAdminImpl.sendEvent(Event) line: 78	
	EventComponent.sendEvent(Event) line: 39	
	EventBroker.send(String, Object) line: 81	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PerspectiveStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	PerspectiveStackImpl.setSelectedElement(MPerspective) line: 135	
	PerspectiveStackImpl.setSelectedElement(MUIElement) line: 1	
	WorkbenchPage.setPerspective(IPerspectiveDescriptor) line: 3116	
	ShowPerspectiveHandler.openPerspective(String, IWorkbenchWindow) line: 146
Comment 3 Remy Suen CLA 2011-03-14 09:34:33 EDT
The perspective creates the tool bar in the beginning.

Then later down the road a recursive 'show' request is forwarded again (see comment 2). Then in the LazyStackRenderer it encounters a part contained within a stack (in its showElementRecursive(*) method) so it, quote unquote, "arbitrarily" destroys the tool bar and then recreates it a few lines down. Normally this wouldn't be a problem but because of the new code we introduced to fix bug 339286 where tool bars don't actually get disposed and unbound, the latter request to create a widget a few lines down does "nothing". That is, we ask the model for a widget and because it has one already it is just returned as-is.

The reason this particular tool item goes away is because it is actually physically in the model so while our disposeWidget(Object) method for tool bars does nothing, the renderer does recursively traverse downwards and call removeGui(MUIElement) on each one of its child elements which is why this tool item contribution gets destroyed. The other items in the tool bar are actions so they appear to be unaffected.

Thread [main] (Suspended (breakpoint at line 866 in ToolItem))	
	ToolItem.setToolTipText(String) line: 866	
	HandledContributionItem.updateToolItem() line: 281	
	HandledContributionItem.update(String) line: 236	
	HandledContributionItem.fill(ToolBar, int) line: 204	
	ToolBarManager.update(boolean) line: 353	
	ToolBarManagerRenderer.processContents(MElementContainer<MUIElement>) line: 476	
	PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 532	
	StackRenderer.showTab(MUIElement) line: 575	
	LazyStackRenderer$1.handleEvent(Event) line: 73	
	UIEventHandler$1.run() line: 41	
	UISynchronizer(Synchronizer).syncExec(Runnable) line: 179	
	UISynchronizer.syncExec(Runnable) line: 150	
	Display.syncExec(Runnable) line: 4668	
	E4Application$1.syncExec(Runnable) line: 172	
	UIEventHandler.handleEvent(Event) line: 38	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 197	
	EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197	
	EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1	
	EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230	
	ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148	
	EventAdminImpl.dispatchEvent(Event, boolean) line: 135	
	EventAdminImpl.sendEvent(Event) line: 78	
	EventComponent.sendEvent(Event) line: 39	
	EventBroker.send(String, Object) line: 81	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 171	
	StackRenderer(LazyStackRenderer).postProcess(MUIElement) line: 110	
	PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 536	
	PartRenderingEngine.createGui(MUIElement) line: 597	
	SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 59	
	PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 532	
	PartRenderingEngine.createGui(MUIElement) line: 597	
	PerspectiveRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 59	
	PerspectiveRenderer.processContents(MElementContainer<MUIElement>) line: 59	
	PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 532	
	PartRenderingEngine.createGui(MUIElement) line: 597	
	PerspectiveStackRenderer.showTab(MUIElement) line: 103	
	LazyStackRenderer$1.handleEvent(Event) line: 73	
	UIEventHandler$1.run() line: 41	
	UISynchronizer(Synchronizer).syncExec(Runnable) line: 179	
	UISynchronizer.syncExec(Runnable) line: 150	
	Display.syncExec(Runnable) line: 4668	
	E4Application$1.syncExec(Runnable) line: 172	
	UIEventHandler.handleEvent(Event) line: 38	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 197	
	EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197	
	EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1	
	EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230	
	ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148	
	EventAdminImpl.dispatchEvent(Event, boolean) line: 135	
	EventAdminImpl.sendEvent(Event) line: 78	
	EventComponent.sendEvent(Event) line: 39	
	EventBroker.send(String, Object) line: 81	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PerspectiveStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	PerspectiveStackImpl.setSelectedElement(MPerspective) line: 135	
	PerspectiveStackImpl.setSelectedElement(MUIElement) line: 1	
	WorkbenchPage.setPerspective(IPerspectiveDescriptor) line: 3116	
	ShowPerspectiveHandler.openPerspective(String, IWorkbenchWindow) line: 146
Comment 4 Remy Suen CLA 2011-03-14 09:50:58 EDT
Created attachment 191114 [details]
ToolBarManagerRenderer patch v1

Change ToolBarManagerRenderer to not dispose any passed in child elements unless they have been rendered by the engine.
Comment 5 Paul Webster CLA 2011-03-14 09:58:08 EDT
Looks good.

PW
Comment 6 Remy Suen CLA 2011-03-14 10:26:21 EDT
(In reply to comment #4)
> Created attachment 191114 [details]
> ToolBarManagerRenderer patch v1

Fix released to CVS HEAD.
Comment 7 Remy Suen CLA 2011-04-26 10:14:18 EDT
Verified with I20110426-0200 on Windows XP.
Comment 8 Remy Suen CLA 2011-04-26 10:16:43 EDT
Verified with I20110426-0200 on Windows XP.