[vtkusers] Render window

Charl P. Botha c.p.botha at its.tudelft.nl
Sun Mar 2 15:03:50 EST 2003


On Sun, Mar 02, 2003 at 01:13:50PM -0600, Tuhin Sinha wrote:
>   Regarding a default window handling procedure, what prevents VTK from 
> implementing a flag that turns on/off window handling by the vtkRenderWindow 
> object.  That is, if the flag is on, then in C++ the vtkRenderWindow object 
> will catch the WM_DESTROY messages and invoke appropriate methods to delete 
> the object.  Otherwise, if the flag is off, the responsibility of destroying 
> the object is up to the user.  It seems weird that the vtkRenderWindow goes 
> through all the trouble of creating the window, but then doesn't provide any 
> functionality for handling its deletion.  Just a thought.

What do you consider to be a correct and generic way to handle this event?
The RenderWindow could e.g. have a reference count of 10, meaning that 10
other objects expect it to exist.  If a destroy handler were impudent enough
to delete the object in spite of this, the application is on its way to
segfault/program error heaven.

One could argue that the default handler could remove all Renderers and
RenderWindowInteractors, but that still would not guarantee a RenderWindow
that is ready to be destroyed.  Remember than ANY object can take out a
reference on a VTK instance.

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



More information about the vtkusers mailing list