[vtkusers] Strange segfault (wxPython + wxVTKRenderWindowInteractor + widget)

Paul Melis paul at science.uva.nl
Thu Mar 8 10:00:28 EST 2007


Charl P. Botha wrote:

> On 3/7/07, Paul Melis <paul at science.uva.nl> wrote:
>
>> Well, a colleague here had the fix: instead of turning on the
>> vtkImagePlaneWidget immediately after creation a deferred call to On()
>> will show the widget correctly without segfaulting. Currently I enable
>> it once in an idle handler, not a really pretty solution.
>
>
> Can you reproduce this segfault with just the example code embedded in
> wxVTKRenderWindowInteractor?

Blegh, after some experimentation with your suggestion I think I've 
found the cause of it all: I was storing the reference to the created 
image plane widget in a local variable, which went out of scope. My 
"fix" to call widget.On() at a later time implied that I had to store a 
reference to the widget somewhere (in the frame object) so that I could 
call On() in the idle handler. This countered the widget from being 
accidently garbage collected.

Regards,
Paul




More information about the vtkusers mailing list