Bug 93289 - Widget is Disposed error when disposing Link in focusOut callback
Summary: Widget is Disposed error when disposing Link in focusOut callback
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
: 319751 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-29 12:32 EDT by Grant Gayed CLA
Modified: 2018-05-15 15:54 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2005-04-29 12:32:05 EDT
I0426

Run the snippet at the bottom and hover over the Shell.  You'll get the
following exception (note that you'll also get some gtk error spew, but this is
a separate gtk bug, logged as http://bugs.gnome.org/show_bug.cgi?id=302445 ):

Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:2940)
	at org.eclipse.swt.SWT.error(SWT.java:2863)
	at org.eclipse.swt.SWT.error(SWT.java:2834)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:402)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:338)
	at org.eclipse.swt.widgets.Control.redraw(Control.java:2324)
	at org.eclipse.swt.widgets.Link.gtk_event_after(Link.java:287)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1343)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3341)
	at org.eclipse.swt.internal.gtk.OS._gtk_widget_set_sensitive(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_widget_set_sensitive(OS.java:7143)
	at org.eclipse.swt.widgets.Control.enableWidget(Control.java:109)
	at org.eclipse.swt.widgets.Link.enableWidget(Link.java:161)
	at org.eclipse.swt.widgets.Control.setEnabled(Control.java:2626)
	at win32.Main0$1.handleEvent(Main0.java:18)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2780)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2474)
	at win32.Main0.main(Main0.java:29)

snippet:

public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setBounds(10, 10, 200, 200);
	final Link link = new Link(shell, SWT.PUSH);
	link.setBounds(10,10,50,50);
	link.setText("abc");
	final Button button = new Button(shell, SWT.PUSH);
	button.setBounds(10,100,50,50);
	shell.addListener(SWT.MouseHover, new Listener() {
		public void handleEvent(Event event) {
			link.setEnabled(false);
		}
	});
	link.addListener(SWT.FocusOut, new Listener() {
		public void handleEvent(Event event) {
			link.dispose();
		}
	});
	shell.open();
	link.setFocus();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
Comment 1 Eric Williams CLA 2018-04-13 15:31:56 EDT
I can't reproduce this on GTK3.22, 4.8 M6, and Fedora 27.
Comment 2 Eric Williams CLA 2018-05-15 15:54:07 EDT
*** Bug 319751 has been marked as a duplicate of this bug. ***