[vtkusers] segfault/hang in vtkRenderer.RemoveActor

marcin.krotkiewski marcin.krotkiewski at gmail.com
Thu Mar 19 10:22:31 EDT 2015


Hello everyone,

I've encountered a problem with Java wrappers and 
vtkRenderer.RemoveActor that results in a segfault or a hang on Windows, 
while all works fine on Linux. The renderer is obtained from a vtkCanvas 
instance, which is embedded in JFrame:

     JFrame frame = new JFrame("crash");
     [... initialize frame ...]

     vtkCanvas canvas = new vtkCanvas();
     vtkRenderer ren = canvas.GetRenderer();
     [... create cone actor ...]

     ren.AddActor(actor);
     canvas.repaint(); // all works nicely, with model rendered and 
interactive

     [sleep 1s]
     // segfault/hangs in RemoveActor on windows,
     // Sometimes output VTK window with error message from vtk shown:
     // ERROR in [partial path]
     // vtkWin32OpenGLRendererWindow([address]):wgIM [missing text]
     //
     // The rendered scene is still interactive, i.e., cone can be 
rotated etc.
     ren.RemoveActor(actor);

As I said, the code works on Linux and the actor is correctly removed. I 
have verified the problem on two Winows 7 systems with java version 
"1.7.0_11" and "1.8.0_31". VTK-6.1.0 is built using Visual Studio 2012 
Professional.

One other problem is rendering of the scene. The canvas.repaint() line 
works, but if I substitute it with

         canvas.lock();
         ren.Render();
         canvas.unlock();

then I also get a crash on both Windows and Linux. I am not sure - do I 
do this correctly, or should I call Render differently?

I would appreciate any help - I will gladly do local debugging. The 
entire compilable Java code is attached.

Thanks

Marcin Krotkiewski


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugtest.java
Type: text/x-java
Size: 2367 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150319/3dc5c415/attachment.java>


More information about the vtkusers mailing list