[vtkusers] Multiple wxVTKRenderWindow: Segmentation fault (core dumped)

Charl P. Botha c.p.botha at ewi.tudelft.nl
Thu Jan 22 07:14:05 EST 2004


On Thu, 2004-01-22 at 12:57, Uwe Rempler wrote:

> >
> thank you very much for your fast reply
> got just a few more "little" questions:
> did you just open the windows or did you also try to close them?

Open a few, close a few, open a few.  It doesn't break here.

> do you run your software also with just one MainLoop()?

Of course.

> do you open multiple windows by creating new instances of wxFrame() - 
> like in my sample code?

I do something similar.  In essence, each wxVTKRenderWindowInteractor
has its own frame.  The user is free to open and  destroy as many of
those as he/she wants.

> which debugger do you use?

gdb

> would you please try to open two windows in a row and close the first 
> opened before the second one - sometimes opening a couple of windows 
> works for me just fine but when i try to close then not in the right 
> order *bam* core dump :(

It didn't break.

> it also works whem i'm quiting the application (after creating some 
> windows) with the exit button - EndMainLoop() ...

Okay.  This (and the other segfaults you're seeing) could have something
to do with the way in which you destroy your windows.  The
wxVTKRenderWindow doesn't automatically get destroyed when you destroy
the parent window.  You have to dissociate the renderwindow from wx
before you Destroy the wxFrame.  Do this by calling WindowRemap on the
encapsulated vtkRenderWindow so it dissociates and creates its OWN
window.  Then destroy the wx part and the VTK part separately by calling
Destroy on the wx part, and making sure that you have no refs left to
the vtk part.

I have been making changes to VTK (primarily the Finalize() and
Initialize() additions to the various RenderWindows), but this is a
long-term plan.  At the moment, I'm waiting for a Mac expert to make the
required changes on the Mac RenderWindows before I can take
Finalize/Initialize up to the abstract interface.  At that stage, it
will be easier to destroy a wxWindow containing a renderwindow.

Good luck,
Charl

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





More information about the vtkusers mailing list