Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Disposing of the parent when the children are disposed
Disposing of the parent when the children are disposed [message #455156] Sun, 08 May 2005 08:22 Go to next message
Eclipse UserFriend
Originally posted by: jjdorney.hotmail.com

Backwards, I know, but I want to do it. Any suggestions?

I started off by creating a DisposeListener that maintained a reference
to the parent object and disposed it when widgetDisposed was called.

That got me an infinite loop as the parent disposed of the child, that
was disposing of the parent, that ... etc..

I stopped most of the infinite loop by changing the listener so that it
detected when it was being called a second time and did nothing on that
call.

That left me with a NullReference error ... which I'm not entirely sure
of. It had something to do with a deregister called on a Control.

I'm stumped. Does anyone have a solution to this? How do I dispose of
a parent when its child has been disposed?

Thanks
Jervina
Re: Disposing of the parent when the children are disposed [message #455182 is a reply to message #455156] Mon, 09 May 2005 23:03 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Doing it inside a Display.asyncExec() should work.

"J. Dorney" <jjdorney@hotmail.com> wrote in message
news:d5kill$gq$1@news.eclipse.org...
> Backwards, I know, but I want to do it. Any suggestions?
>
> I started off by creating a DisposeListener that maintained a reference
> to the parent object and disposed it when widgetDisposed was called.
>
> That got me an infinite loop as the parent disposed of the child, that
> was disposing of the parent, that ... etc..
>
> I stopped most of the infinite loop by changing the listener so that it
> detected when it was being called a second time and did nothing on that
> call.
>
> That left me with a NullReference error ... which I'm not entirely sure
> of. It had something to do with a deregister called on a Control.
>
> I'm stumped. Does anyone have a solution to this? How do I dispose of
> a parent when its child has been disposed?
>
> Thanks
> Jervina
>
>
Re: Disposing of the parent when the children are disposed [message #455188 is a reply to message #455182] Tue, 10 May 2005 03:17 Go to previous message
Eclipse UserFriend
Originally posted by: jjdorney.hotmail.com

"Steve Northover" <steve_northover@ca.ibm.com> wrote in message
news:d5oqmj$e8v$1@news.eclipse.org...
> Doing it inside a Display.asyncExec() should work.
[snip]


Oh. Okay, I feel stupid :). I was doing one of those during my
ill-fated attempt to having the parent poll its child to determine
whether it was disposed or not. That didn't end up being a good idea.
It never occurred to me to just use it for disposing the parent.

Thanks. I'll try that now.
Jervina
Previous Topic:setmenu does not select items from list control?
Next Topic:Combo problem
Goto Forum:
  


Current Time: Wed Apr 24 22:26:49 GMT 2024

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

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

Back to the top