Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348389 - SWT dispose exception on thumbnail
Summary: SWT dispose exception on thumbnail
Status: CLOSED FIXED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 0.8.0   Edit
Assignee: Tim Kaiser CLA
QA Contact:
URL:
Whiteboard: Indigo RC4 theme_bugs
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 08:45 EDT by Ronald Krijgsheld CLA
Modified: 2011-06-24 08:52 EDT (History)
1 user (show)

See Also:
tim.kaiser: indigo+


Attachments
mylyn/context/zip (1.32 KB, application/octet-stream)
2011-06-06 10:59 EDT, Tim Kaiser CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ronald Krijgsheld CLA 2011-06-06 08:45:52 EDT
Build Identifier: 20110301-1815

I sometimes see the following exception in my eclipse log:


Caused by: org.eclipse.swt.SWTException: Graphic is disposed
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.SWT.error(SWT.java:3969)
at org.eclipse.swt.graphics.GC.getAdvanced(GC.java:3207)
at org.eclipse.draw2d.SWTGraphics.restoreState(SWTGraphics.java:928)
at org.eclipse.draw2d.SWTGraphics.popState(SWTGraphics.java:828)
at org.eclipse.draw2d.ScaledGraphics.popState(ScaledGraphics.java:657)
at org.eclipse.draw2d.ScaledGraphics.dispose(ScaledGraphics.java:277)
at
org.eclipse.graphiti.ui.internal.fixed.FixedThumbnail$ThumbnailUpdater.stop(FixedThumbnail.java:308)
at
org.eclipse.graphiti.ui.internal.fixed.FixedThumbnail$ThumbnailUpdater.run(FixedThumbnail.java:202)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 22 more


I was looking at the FixedThumbnail.java at line 308 and was wondering
whether the dispose of the thumbnailGC should be after the dispose of
the thumbnailGraphics instead of before. see copied code snipped:

             public void stop() {
isRunning = false;
if (thumbnailGC != null) {
thumbnailGC.dispose();
thumbnailGC = null;
}
if (thumbnailGraphics != null) {
thumbnailGraphics.dispose();
thumbnailGraphics = null;
}
             }


Reproducible: Sometimes
Comment 1 Michael Wenz CLA 2011-06-06 08:50:15 EDT
I have seen this sporadically in test runs, but not yet during normal work with an editor. Where do you get this exception?

Michael
Comment 2 Tim Kaiser CLA 2011-06-06 10:58:12 EDT
I could reproduce your issue
and since disposing of the graphics 
can depend on having a GC the order should be changed,
(also since the GC is created first it should be disposed of last).
Thanks for the hint!
Comment 3 Tim Kaiser CLA 2011-06-06 10:59:26 EDT
Created attachment 197401 [details]
mylyn/context/zip
Comment 4 Michael Wenz CLA 2011-06-24 08:52:27 EDT
Part of Graphiti Indigo 0.8.0