Mapper bug - sort of.

John Biddiscombe j.biddiscombe at rl.ac.uk
Sun Dec 5 17:01:16 EST 1999


Dear vtk,

Please stop me if I'm posting too many bug reports.

vtkMapper and sub classes can get munged if you do this...

This is bad
-----------
render->RemoveProp(prop);
Renderwindow->Delete()
prop->Delete()

this is good
------------
Renderwindow->Delete()
prop->Delete()


The problem is that when you call RemoveProp(), the renderer doesn't call
ReleaseGraphicsResources() on the mapper - (this may be sensible if you're
about to put the prop into another window and may have to redo a massive
displaylist).
However, the mapper keeps its renderwindow pointer and when the window is
deleted, the pointer is left hanging. Subsequent deletion of the prop
causes a pointer violation during the destructor cleaning up.

The solution is for users to call ReleaseGraphicsResources themselves when
deleting a prop if they think the window may disappear ...

My own solution is to add a flag to removeprop (in my code) which says
whether the window is being deleted or left. If deleted, then
ReleaseGrraphicsResources should be called.

This may not be a good solution because the prop may be removed without a
window deletion occuring, then later the window is really deleted, and now
the pointer is left hanging. The only safe solution is to call
ReleaseGraphicsResources every time. - if an alternative ReplaceProp
routine were used, then one could safely pass the display lists from one
renderer to another without worrying but there are no doubt other reasons
why this wouldn't work. (not least opengl display contexts anyway).

ttfn

John B



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list