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

Bug 334512

Summary: Reattaching detached 'Error Log' view seems to kill the view
Product: [Eclipse Project] PDE Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: curtis.windatt.public
Version: 3.7Keywords: contributed
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
'Error Log' view patch v1 none

Description Remy Suen CLA 2011-01-17 09:00:57 EST
1. Window > Show View > Error Log
2. Detach the 'Error Log' view.
3. File > Restart
4. Reattach the 'Error Log' view to the workbench window.
5. Double-click on an entry in the log, an error will occur.

May be related to bug 334411.

org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:4185)
at org.eclipse.swt.SWT.error(SWT.java:4100)
at org.eclipse.swt.SWT.error(SWT.java:4071)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.getDisplay(Widget.java:582)
at org.eclipse.ui.internal.views.log.EventDetailsDialog.<init>(EventDetailsDialog.java:107)
at org.eclipse.ui.internal.views.log.EventDetailsDialogAction.run(EventDetailsDialogAction.java:95)
at org.eclipse.ui.internal.views.log.LogView$15.doubleClick(LogView.java:535)
at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:824)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:822)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1421)
at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1225)
at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:239)
at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:236)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:297)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4089)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3680)
Comment 1 Remy Suen CLA 2011-01-17 14:24:19 EST
Basic gist of the problem as follows:
1. Part is created and the part's shell is cached (the shell is said detached window).
2. Part is reattached to the workbench window.
3. Cached shell is no longer valid because the detached window is gone, the SWTException is thrown.

Why does this work in 3.x? Because of the big lie, the controls are first created under the workbench window so the cached shell is safe (instead of being a volatile one in 4.x).
Comment 2 Eric Moffatt CLA 2011-01-17 15:35:13 EST
In this case I think we should modify the code in the offending view (at least we own it). I'm truly loathe to add unnecessary complexity to the rendering story in order to handle what is actually bad code in an existing part.

The current rendering story makes sense (i.e. your shell is actually the shell that you're being created in) and anything else might be considered a defect in E4 apps. Why do I get created under the main shell when my part is in a detached window? The answer that the Error Log view needed it isn't sufficient...;-).

If this turns out to be a common problem we can re-evaluate the approach but even then it should be limited somehow to only parts that need it or made specific to the compatibility layer.
Comment 3 Remy Suen CLA 2011-01-17 20:14:42 EST
Would like to request that PDE changes their potentially volatile code.
Comment 4 Remy Suen CLA 2011-01-18 07:45:57 EST
Created attachment 186992 [details]
'Error Log' view patch v1

Please use the attached patch to prevent the use of cached shells that may go stale.
Comment 5 Curtis Windatt CLA 2011-01-19 17:37:40 EST
Fixed in HEAD.  Marking as FIXED as it looks like this is the only view that needs changes.  Thanks Remy.
Comment 6 Curtis Windatt CLA 2011-01-26 13:02:51 EST
Verified in I20110126-0800