[vtkusers] extending c++ interaction classes and using them with Java

Henrik Westerberg henrik.westerberg at crg.es
Tue Dec 15 09:07:31 EST 2009


Hi vtkusers,

After some checking on the list I realized that its not possible to sub class a vtk class in Java and use
the class due to the Wrapping.

So I have chosen to extend vtkInteractorTrackballActor.cxx. However I don't know anything about programming
in C++ or changing VTK classes so if someone can eyeball my class and tell me if I missed anything obvious
I would really appreciate it. I have attempted to override UniformScale to only scale in X .

The reason is I am quite often getting a Java VM crash when swapping interactor styles between my extended 
Interactor and any of the default VTK ones. The swap is going through: setInteractorStyle in vtkCanvas.

I have included a header file and c++ file.

The java vm crash logs are a bit big so I can send if anyone is interested but there are a couple of bits below
I have pulled out: 

thanks,
Henrik

Stack: [0x78fcc000,0x7901d000],  sp=0x7901b9dc,  free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x761c774b
C  [libvtkRendering.so.5.5+0x21f3ea]  _ZN39vtkInteractorStyleTrackballActorResizeYD0Ev+0x50
C  [libvtkCommon.so.5.5+0x24d778]  _ZN13vtkObjectBase18UnRegisterInternalEPS_i+0x7a
C  [libvtkCommon.so.5.5+0x24b5d0]  _ZN9vtkObject18UnRegisterInternalEP13vtkObjectBasei+0x3a0
C  [libvtkCommon.so.5.5+0x24d5ab]  _ZN13vtkObjectBase10UnRegisterEPS_+0x27
C  [libvtkCommon.so.5.5+0x24d520]  _ZN13vtkObjectBase6DeleteEv+0x20
C  [libvtkCommonJava.so.5.5.0+0x6c83f]  Java_vtk_vtkObjectBase_VTKDelete+0x39
j  vtk.vtkObjectBase.VTKDelete()V+0
j  vtk.vtkObjectBase.Delete()V+6
j  vtk.vtkObjectBase.finalize()V+8
v  ~StubRoutines::call_stub
V  [libjvm.so+0x375c9d]
V  [libjvm.so+0x5057f8]
V  [libjvm.so+0x375b30]
V  [libjvm.so+0x39f557]
V  [libjvm.so+0x385fea]
C  [libjava.so+0xcb9e]  Java_java_lang_ref_Finalizer_invokeFinalizeMethod+0x6e
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
v  ~StubRoutines::call_stub
V  [libjvm.so+0x375c9d]
V  [libjvm.so+0x5057f8]
V  [libjvm.so+0x3755b0]
V  [libjvm.so+0x37563d]
V  [libjvm.so+0x3e5ca5]
V  [libjvm.so+0x5cde5d]
V  [libjvm.so+0x506929]
C  [libpthread.so.0+0x549b]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  vtk.vtkObjectBase.VTKDelete()V+0
j  vtk.vtkObjectBase.Delete()V+6
j  vtk.vtkObjectBase.finalize()V+8
v  ~StubRoutines::call_stub
j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
j  java.lang.ref.Finalizer.runFinalizer()V+45
j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
v  ~StubRoutines::call_stub


VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkInteractorStyleTrackballActorResizeX.cxx
Type: text/x-c++src
Size: 2834 bytes
Desc: vtkInteractorStyleTrackballActorResizeX.cxx
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091215/6bfd22e2/attachment.cxx>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkInteractorStyleTrackballActorResizeX.h
Type: text/x-chdr
Size: 2237 bytes
Desc: vtkInteractorStyleTrackballActorResizeX.h
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091215/6bfd22e2/attachment.h>


More information about the vtkusers mailing list