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

Bug 258886

Summary: AbstractHyperlink.handleActivate() causes "Widget is disposed" exception
Product: [Eclipse Project] Platform Reporter: Konstantin Komissarchik <konstantin>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: agarcher, caniszczyk, remy.suen
Version: 3.4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Konstantin Komissarchik CLA 2008-12-15 18:53:21 EST
Consider a hyperlink sitting on a detail section of a master-details form. When the hyperlink is selected, the listener disposes of the current details section and loads a new one.

This scenario fails with Widget is disposed problem because handleActivate assumes that the hyperlink widget exists after hyperlink listeners have been called. Here is a snippet of relevant code from handleActivate.

for (int i = 0; i < size; i++) {
    IHyperlinkListener listener = (IHyperlinkListener) listenerList[i];
    listener.linkActivated(he);
}
if (!isDisposed())
    setCursor(FormsResources.getHandCursor());
triggerAccessible();

The failure happens on triggerAccessible() call. Depending on what that call is supposed to do, it should either happen before hyperlink listeners are called or be covered by the !isDisposed() check.

org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:3777)
	at org.eclipse.swt.SWT.error(SWT.java:3695)
	at org.eclipse.swt.SWT.error(SWT.java:3666)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:463)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:336)
	at org.eclipse.swt.widgets.Control.getAccessible(Control.java:1022)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.triggerAccessible(AbstractHyperlink.java:235)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:231)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:320)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink.access$2(AbstractHyperlink.java:304)
	at org.eclipse.ui.forms.widgets.AbstractHyperlink$4.handleEvent(AbstractHyperlink.java:119)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	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:386)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Comment 1 Chris Aniszczyk CLA 2008-12-15 18:56:34 EST
This is a dupe and was fixed in 3.4.2, let me try to dig up the forms bug.
Comment 2 Remy Suen CLA 2008-12-16 00:41:16 EST
(In reply to comment #1)
> let me try to dig up the forms bug.

Oh no you don't.

*** This bug has been marked as a duplicate of bug 250505 ***
Comment 3 Adam Archer CLA 2008-12-16 11:01:36 EST
Thanks for the triage all.  :)