Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 261915 - [JFace] Widget disposed exception when tooltip hides
Summary: [JFace] Widget disposed exception when tooltip hides
Status: CLOSED DUPLICATE of bug 462065
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-21 16:19 EST by Yujie Lin CLA
Modified: 2016-01-05 04:33 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yujie Lin CLA 2009-01-21 16:19:00 EST
Build ID: M20080911-1700

Steps To Reproduce:
We see this exception when running Rational UI test.
The test hovers over an editor toolbar button, then closes the editor. I suspect the test runs so fast that it closes the editor before the tooltip gets hidden.


More information:
Detail error: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:446)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:384)
at org.eclipse.swt.widgets.Control.getShell(Control.java:2459)
at org.eclipse.jface.window.ToolTip.toolTipHide(ToolTip.java:452)
at org.eclipse.jface.window.ToolTip.access$1(ToolTip.java:450)
at org.eclipse.jface.window.ToolTip$6.run(ToolTip.java:537)
at org.eclipse.swt.widgets.Display.timerProc(Display.java:3886)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1541)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3031)
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 com.fnfr.svt.rcp.Application.runWorkbench(Application.java:212)
at com.fnfr.svt.rcp.Application.start(Application.java:197)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 Thomas Schindl CLA 2010-01-28 17:13:53 EST
multi change because of intenion of stepping back as platform-ui committer
Comment 2 cody2010 CLA 2010-05-18 08:13:55 EDT
Also happens on Windows Build 3.4.2.M20090107-0800.
And it looks like it's the same in your subversion repository as of now.

I suspect the dispose listener in the constructor to be the problem. It calls ToolTip.deactivate which unregisters the ToolTipOwnerControlListener. Unfortunately, this happens before this listener could run and hide the tooltip, thus leaving it open although the owning control has been disposed. When later trying to hide the tooltip the above exception is thrown.
Comment 3 Andrei Diaconu CLA 2011-05-18 06:00:37 EDT
Here is a snippet to reproduce the bug:

	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setLayout(new FillLayout(SWT.VERTICAL));

		final Label label = new Label(shell, SWT.NONE);
		label.setText("Focus the combo\n"
		              + "Hover over label until tool tip appears\n"
		              + "Move the mouse wheel");
		final DefaultToolTip toolTip = new DefaultToolTip(label);
		toolTip.setText("text");

		final Combo combo = new Combo(shell, SWT.READ_ONLY);
		combo.setItems(new String[]{"1", "2"});
		combo.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
				label.dispose();
			}
		});

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}
Comment 4 Thomas Schindl CLA 2011-05-18 06:47:02 EDT
This should be quite trivial and safe to fix because all we need is to also handle the disposal
Comment 5 Olaf Titz CLA 2015-03-13 08:22:18 EDT
This is likely the same issue as in bug 396296.
Comment 6 Conrad Groth CLA 2015-12-29 09:09:03 EST
Duplicate of bug 462065
Comment 7 Lars Vogel CLA 2016-01-05 04:33:53 EST

*** This bug has been marked as a duplicate of bug 462065 ***