Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How can a widget be disposed without a call to dispose()?
How can a widget be disposed without a call to dispose()? [message #870858] Thu, 10 May 2012 01:59 Go to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
How is it possible for a widget to be disposed if its dispose() was never called? I'm seeing an odd bug in an RCP app that shows up as:
org.eclipse.swt.SWTException: Widget is disposed

So I set a breakpoint in
Widget.dispose()
to find out how/why it was being disposed. To my surprise, the breakpoint was never hit for the widget in question.

Here's the top of the stack trace:
org.eclipse.swt.SWTException: Widget 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.widgets.Widget.error(Widget.java:774)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:568)
	at org.eclipse.swt.widgets.Widget.addDisposeListener(Widget.java:467)
	at org.eclipse.jface.fieldassist.ControlDecoration.addControlListeners(ControlDecoration.java:602)
	at org.eclipse.jface.fieldassist.ControlDecoration.<init>(ControlDecoration.java:476)
	at org.eclipse.jface.fieldassist.ControlDecoration.<init>(ControlDecoration.java:428)


This is an RCP app built against a 3.7.2 target platform.

[Updated on: Thu, 10 May 2012 02:02]

Report message to a moderator

Re: How can a widget be disposed without a call to dispose()? [message #871088 is a reply to message #870858] Thu, 10 May 2012 18:51 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You'd have to add a dispose listener to the widget when it's created to find out when it is disposed. In SWT, if I dispose a Composite, it disposes all of its children. Their dispose isn't called, but they would get SWT.Dispose events.

PW


Re: How can a widget be disposed without a call to dispose()? [message #871098 is a reply to message #871088] Thu, 10 May 2012 20:20 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Thanks, Paul. I didn't know widgets would be disposed that way without their dispose() being called. I'll set up a dispose listener to see if I can find what's happening.
Previous Topic:Problem forcing focus in combo text field
Next Topic:SWT equivalent of AWT Component.addNotify()
Goto Forum:
  


Current Time: Thu Apr 25 14:55:22 GMT 2024

Powered by FUDForum. Page generated in 0.03032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top