| Summary: | [Forms] Graphics disposed in form editor due to redraw of disabled image | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Thomas Ehrnhoefer <thomas.ehrnhoefer> | ||||||
| Component: | User Assistance | Assignee: | Chris Goldthorpe <cgold> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cgold, remy.suen, robert.munteanu, shawn.minto, steffen.pingel, thomas.ehrnhoefer, tomasz.zarna | ||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | 3.8 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 358647 | ||||||||
| Attachments: |
|
||||||||
|
Description
Thomas Ehrnhoefer
stacktrace: org.eclipse.swt.SWTException: Graphic is disposed at org.eclipse.swt.SWT.error(SWT.java:4282) at org.eclipse.swt.SWT.error(SWT.java:4197) at org.eclipse.swt.SWT.error(SWT.java:4168) at org.eclipse.swt.graphics.Image.getBounds(Image.java:1164) at org.eclipse.ui.forms.widgets.ImageHyperlink.paintHyperlink(ImageHyperlink.java:108) at org.eclipse.ui.forms.widgets.ImageHyperlink.paintHyperlink(ImageHyperlink.java:93) at org.eclipse.ui.forms.widgets.AbstractHyperlink.paint(AbstractHyperlink.java:296) at org.eclipse.ui.forms.widgets.AbstractHyperlink$2.paintControl(AbstractHyperlink.java:84) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:229) 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.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1564) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4585) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) See ImageHyperlink line 82 where it disposes teh disabledImage but never sets it to null. I am unsure why paint is being called after the dispose occurs. Do you have steps to reproduce the problem? I don't have anything to show it off in as it is a custom Mylyn task editor page where this is reproducable. The basic order of actions goes as follows though: * Create an ImageHyperlink on a form page * set the image on the link (which creates the disabled image in the ImageHyperlinkClass) * set the image on the link to null * set the ImageHyperlink to be disabled (i.e. setEnabled(false) ) * create a button that disposes all controls and redraws them in the same form page If you open the form page and click the button, you should see the error right away. Created attachment 203806 [details]
Patch to create test case
I have been able to reproduce by applying the attached patch to org.eclipse.ui.forms.examples.
It seems that these two lines were the only ones required.
ih.setImage(null);
ih.setEnabled(false);
There was no need to dispose any controls.
Created attachment 203807 [details]
Fix version 1
This patch fixes the Graphic is disposed exception for my test case. I'm pretty sure that it will fix the problem you were seeing. Do you want to test the fix before I commit the change?
*** Bug 333329 has been marked as a duplicate of this bug. *** Thanks for fixing this! Any change this change could make it into 3.7.2? This looks like the correct fix to me Chris! Thanks for the quick response on this. Patch applied to R3_development and R4_development streams. This is now fixed for Eclipse 3.8 and 4.2 I agree that the fix should go into 3.7.2 - I will clone this bug to track the backport. Once this is in a build can someone verify that it fixes the original problem? *** Bug 314484 has been marked as a duplicate of this bug. *** |