[vtkusers] VTK+JAVA Crash in mouse events

Shyam Prakash ramakrishna.prakash at quest-global.com
Wed Nov 19 04:32:01 EST 2003


Jeff,
	The program that I sent you was just to demonstrate my problem.
Your idea of actors getting gc'ed while they are still in renderer could
be a possibility. But then I can not convince my self how this could
happen as the actor still has a reference to the renderer. Do you have
any idea?

Thanks
Shyam

-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
Of Jeff Lee
Sent: Tuesday, November 18, 2003 8:06 PM
To: Shyam Prakash
Cc: vtkusers at public.kitware.com
Subject: Re: [vtkusers] VTK+JAVA Crash in mouse events

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(vtkGenericRenderWind
owInteractor.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
>




More information about the vtkusers mailing list