Bug 280665 [Forms] Widget is disposed exception caused by FormToolkit$KeyboardHandler.keyPressed(FormToolki t.java:179)
I have a PopupDialog with a form inside it. The form holds a FormText control with a link in it. The link handler does some stuff and then closes the dialog. When I activate the link with a mouse, there is no problem. When I activate the link with keyboard, I see the following exception in the log. It looks like the key listener registered by the form toolkit is not checking if the widget has already been disposed by the time that listener is called. I put in a temporary workaround which involves calling asyncExec inside my link handler, but I would like to see this fixed. Should be pretty trivial. org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:3884) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) 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.getParent(Control.java:1355) at org.eclipse.ui.internal.forms.widgets.FormUtil.getScrolledComposite(FormUtil.j ava:204) at org.eclipse.ui.internal.forms.widgets.FormUtil.processKey(FormUtil.java:377) at org.eclipse.ui.forms.widgets.FormToolkit$KeyboardHandler.keyPressed(FormToolki t.java:179) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:155) 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.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1368) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4053) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:346) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3946) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4589) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2409) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3471) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.ja va:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:19 4) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Ec lipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppL auncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) 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.j ava:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/FormUtil.java
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.ColumnLayout;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ILayoutExtension;
import com.ibm.icu.text.BreakIterator;
public class FormUtil {
	public static final String PLUGIN_ID = "org.eclipse.ui.forms"; 
	static final int H_SCROLL_INCREMENT = 5;
	static final int V_SCROLL_INCREMENT = 64;
	public static final String DEBUG = PLUGIN_ID + "/debug"; 
	public static final String DEBUG_TEXT = DEBUG + "/text"; 
	public static final String DEBUG_TEXTSIZE = DEBUG + "/textsize"; 
	public static final String DEBUG_FOCUS = DEBUG + "/focus"; 
	public static final String FOCUS_SCROLLING = "focusScrolling"; 
	
	public static final String IGNORE_BODY = "__ignore_body__"; 
	public static Text createText(Composite parent, String label,
			FormToolkit factory) {
		return createText(parent, label, factory, 1);
	}
	public static Text createText(Composite parent, String label,