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

Bug 326699

Summary: Part in shared area finds wrong parent context during shutdown
Product: [Eclipse Project] e4 Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Eric Moffatt <emoffatt>
Severity: major    
Priority: P3 CC: deepakazad, gheorghe, remy.suen
Version: 1.0   
Target Milestone: 4.1 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Log file
none
PartRenderingEngine patch v1 none

Description John Arthorne CLA 2010-09-30 14:16:26 EDT
Build: 4.1 M2.

After working for a couple of days, I attempted to shutdown and got an NPE. I was unable to close the application normally and had to kill the process. Complete log to follow but here is a snippet:

java.lang.NullPointerException
	at org.eclipse.ui.internal.WorkbenchWindow.hardClose(WorkbenchWindow.java:1322)
	at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:1059)
	at org.eclipse.ui.internal.WorkbenchWindow.access$9(WorkbenchWindow.java:1038)
	at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:1085)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
Comment 1 John Arthorne CLA 2010-09-30 14:16:55 EDT
Created attachment 179984 [details]
Log file
Comment 2 Remy Suen CLA 2010-09-30 14:33:46 EDT
This isn't as rampant as it once was though I do see it. The current way of
tearing down the rendered widgets without any checks (bug 323014) is too
fragile.
Comment 3 John Arthorne CLA 2010-10-14 16:52:50 EDT
I keep getting this, and it's a major problem because on restart after crashing it takes a long time to get the workspace back into a good state. Bogdan is seeing this too on latest 4.1 I-build.
Comment 4 Remy Suen CLA 2010-10-14 17:12:29 EDT
(In reply to comment #3)
> I keep getting this, and it's a major problem because on restart after crashing
> it takes a long time to get the workspace back into a good state. Bogdan is
> seeing this too on latest 4.1 I-build.

I have delivered a change for bug 323014 that should at least allow you to shutdown now...I hope.

It should be in tonight's build assuming I tagged properly.
Comment 5 Remy Suen CLA 2010-10-15 08:45:14 EDT
1. Open one Java file.
2. Open another Java file.
3. Activate the first editor from step 1.
4. Window > Open Perspective > Debug
5. Window > Open Perspective > Java
6. Shutdown. The NPE will occur.

Investigating...
Comment 6 Remy Suen CLA 2010-10-15 09:05:41 EDT
When the first editor is closed during the disposal of the 'Debug' perspective (after the 'Java' perspective has been taken care of), the CTabFolder's logic kicks in and tries to select the second editor. At this point, we try to reparent its context if necessary and it seems to walk up its parent chain and find the [disposed] 'Java' perspective instead of the 'Debug' perspective.

Thread [main] (Suspended)	
	ModelServiceImpl.getContainingContext(MUIElement) line: 173	
	StackRenderer(LazyStackRenderer).showElementRecursive(MUIElement, List<MUIElement>) line: 288	
	StackRenderer(LazyStackRenderer).showTab(MUIElement) line: 145	
	StackRenderer.showTab(MUIElement) line: 498	
	LazyStackRenderer$1.handleEvent(Event) line: 74	
	UIEventHandler.handleEvent(Event) line: 41	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 188	
	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: 73	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 159	
	StackRenderer$3.widgetSelected(SelectionEvent) line: 437	
	TypedListener.handleEvent(Event) line: 234	
	EventTable.sendEvent(Event) line: 84	
	CTabFolder(Widget).sendEvent(Event) line: 1053	
	CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1077	
	CTabFolder(Widget).sendEvent(int, Event) line: 1062	
	CTabFolder(Widget).notifyListeners(int, Event) line: 774	
	CTabFolder.setSelection(int, boolean) line: 2830	
	CTabFolder.destroyItem(CTabItem) line: 519	
	CTabItem.dispose() line: 126	
	StackRenderer.hideChild(MElementContainer<MUIElement>, MUIElement) line: 396	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 592	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	ElementReferenceRenderer.disposeWidget(MUIElement) line: 108	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 607	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	PartRenderingEngine.safeRemoveGui(MUIElement) line: 603	
	PartRenderingEngine.access$1(PartRenderingEngine, MUIElement) line: 581	
	PartRenderingEngine$5.run() line: 576	
	SafeRunner.run(ISafeRunnable) line: 42	
	PartRenderingEngine.removeGui(MUIElement) line: 562	
	WorkbenchWindow.hardClose(boolean) line: 1356
Comment 7 Remy Suen CLA 2010-10-15 11:07:51 EDT
Created attachment 180967 [details]
PartRenderingEngine patch v1

Patch to render non-selected elements before the selected one so that eager selection changes will not cause problems on shutdown.
Comment 8 Remy Suen CLA 2010-10-15 11:09:31 EDT
(In reply to comment #7)
> Created an attachment (id=180967) [details]
> PartRenderingEngine patch v1

Patch released to CVS HEAD. Thanks for putting up with this bug, everyone.
Comment 9 Remy Suen CLA 2010-10-26 13:25:14 EDT
Verified on Windows XP with I20101025-1602.

If anyone has problems shutting down or see exceptions on shutdown, please open new bugs, thank you.