[vtkusers] RenderWindow question...

Charl P. Botha c.p.botha at its.tudelft.nl
Thu Feb 27 16:51:04 EST 2003


On Thu, Feb 27, 2003 at 03:29:34PM -0600, Tuhin wrote:
> > How do you delete this window?
> 
> The user deletes it, by clicking on the window decoration close button.  The 
> only way (that I know) to catch this is to have the window manager send you 
> an event (i.e. WM_DESTROY_WINDOW).  If VTK catches this event, then that's 
> great.... however, on my inspection of the code i can't find where this 
> callback is setup.  Also, I'm not using XOpenGLRenderWindow directly, but I 
> think that's where the code and the problem should be.

Because VTK uses reference counting on all objects, you have to catch this
event and do something sane with it.  In my FLTK projects, I take care of
the whole pipeline leading up to the embedded RenderWindow in my window
close handler.  In my wxPython projects, I reparent the RenderWindow in my
close handler and make sure that there are no references to any component of
the VTK instance chain leading up to that RenderWindow.

In short, you have to take care of it.  It would be near impossible to
create an elegant and generic close handler (in VTK) that would be
intelligent enough to take care of all possibilities, especially with
regards to references that the user *might* have hanging around.

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/



More information about the vtkusers mailing list