[vtkusers] VTK+JAVA Crash in mouse events

Jeff Lee jeff at cdnorthamerica.com
Tue Nov 18 09:35:31 EST 2003


I think the main problem was that your actors were getting gc'ed while 
the mouse was moving.  You should be careful to remove actors from the 
renderer which might be garbage collected for any reason.  Furthermore, 
you were creating a new plane widget every time the action was triggered 
- was that your intent?  If so, you need to remove the old one from the 
renderer first.  In the future, if you see this type of behavior, it is 
almost guaranteed to be related to some object unwittingly being a 
candidate for garbage collection, and the object gets deleted while 
still in the renderer.  I attached a better-behaving version of your 
code, but it may not be what you intended.
-Jeff

Shyam Prakash wrote:

> Hello,
>
>             I had encountered this problem earlier too. The program 
> suddenly crashes in mouseMove, mouseDrag,mousePress or mouseRelease 
> events with a message similar to the message given below.
>
>  
>
> Current Java thread:
>
>       at vtk.vtkGenericRenderWindowInteractor.MouseMoveEvent_2(Native 
> Method)
>
>       at 
> vtk.vtkGenericRenderWindowInteractor.MouseMoveEvent(vtkGenericRenderWindowInteractor.java:19)
>
>       at vtk.vtkCanvas.mouseDragged(vtkCanvas.java:209)
>
>       at java.awt.Component.processMouseMotionEvent(Component.java:5182)
>
>       at java.awt.Component.processEvent(Component.java:4935)
>
>  
>
> I am not sure what exactly could be the problem. I am using vtk 4.2.2 
> on Windows2k with jdk 1.4.1_02. Attached is a sample code. When I run 
> this code, it often crashes in my machine when I rotate the model 
> vigorously(in combination with resizing the window). My gut feeling is 
> it could be because of the presence of vtkImplicitPlaneWidget. Is 
> there anyway I can avoid this?
>
>  
>
> Thanks
>
> Shyam
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestLineAndPlane.java
Type: text/x-java
Size: 3665 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031118/c06344ca/attachment.java>


More information about the vtkusers mailing list