Bug 320201 - [JFace] SWTException when disposing TreeItems with decorated images
Summary: [JFace] SWTException when disposing TreeItems with decorated images
Status: REOPENED
Alias: None
Product: RAP
Classification: RT
Component: JFace (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 388728 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-18 15:52 EDT by Ralf Sternberg CLA
Modified: 2012-09-28 07:43 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Sternberg CLA 2010-07-18 15:52:59 EDT
When letting ImageDescriptor dispose images as in original JFace code, the following exception has been observed:

ERROR:  Exception while disposing shell: Shell {RAP Workbench Demo}
org.eclipse.swt.SWTException: Graphic is disposed
	at org.eclipse.swt.SWT.error(SWT.java:3199)
	at org.eclipse.swt.SWT.error(SWT.java:3119)
	at org.eclipse.swt.SWT.error(SWT.java:3090)
	at org.eclipse.swt.graphics.Image.getBounds(Image.java:264)
	at org.eclipse.swt.widgets.TreeItem.getPreferredWidth(TreeItem.java:1231)
	at org.eclipse.swt.widgets.Tree.needsHScrollBar(Tree.java:1839)
	at org.eclipse.swt.widgets.Tree.updateScrollBars(Tree.java:1854)
	at org.eclipse.swt.widgets.TreeItem.releaseParent(TreeItem.java:1625)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:775)
	at org.eclipse.swt.widgets.TreeItem.releaseChildren(TreeItem.java:1614)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.TreeItem.releaseChildren(TreeItem.java:1614)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Tree.releaseChildren(Tree.java:1564)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:817)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:817)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:817)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:817)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:817)
	at org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:1062)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:774)
	at org.eclipse.swt.widgets.Display.disposeShells(Display.java:728)
	at org.eclipse.swt.widgets.Display.release(Display.java:694)
	at org.eclipse.swt.graphics.Device.dispose(Device.java:282)
	at org.eclipse.rwt.internal.lifecycle.UIThread.processShutdown(UIThread.java:159)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:128)
	at java.lang.Thread.run(Thread.java:619)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)

To reproduce, open the default workbench demo, expand the Tree to show a decorated image, and wait for session timeout.
Problem is that the image is disposed before the Tree's items.
As a workaround, the code in ImageDescriptor#destroyResource() is disabled.
Comment 1 Ivan Furnadjiev CLA 2012-08-14 04:56:04 EDT
The issue has been fixed with the Tree/TreeItem refactorings (check for Tree isInDispose in TreeItem#releaseParent) in RAP 1.5. Reactivate the code in ImageDescriptor#destroyResource() with commit 80869bc719b3c0b2a3ca2a597b0d7a1e31777b16.
Comment 2 Ivan Furnadjiev CLA 2012-09-27 13:55:04 EDT
The issue is still valid. Reproducible with Examples Demo when reloading the demo (F5). Revert the commit 80869bc719b3c0b2a3ca2a597b0d7a1e31777b16.
Comment 3 Ivan Furnadjiev CLA 2012-09-28 07:43:30 EDT
*** Bug 388728 has been marked as a duplicate of this bug. ***