MantisBT - VTK
View Issue Details
0007674VTK(No Category)public2008-09-15 05:322016-08-12 09:55
Kristian Sons 
Kitware Robot 
normalcrashalways
closedmoved 
 
 
0007674: [VTK Java] Crashes if setting null - Object
Following code leads to a crash in jvm.dll:

vtkActor myActor = new vtkActor();
myActor.SetTexture(null);

Thus it is not possible to unset the texture of an actor. Same is true for all other functions with objects as parameter.

Reason:
This is because JNI:GetObjectClass will be called with null object. This is not allowed (s.http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/functions.html#wp16334 [^]).

Fix suggestion:
In vtkJavaUtil.cxx change function vtkJavaGetPointerFromObject to:

JNIEXPORT void *vtkJavaGetPointerFromObject(JNIEnv *env, jobject obj)
{
    return obj == NULL ? NULL : (void*)(size_t)vtkJavaGetId(env, obj);
}
No tags attached.
Issue History
2008-09-15 05:32Kristian SonsNew Issue
2008-10-16 06:45dbarbierNote Added: 0013892
2008-10-23 04:29dbarbierNote Added: 0013920
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:55Kitware RobotNote Added: 0037016
2016-08-12 09:55Kitware RobotStatusexpired => closed
2016-08-12 09:55Kitware RobotResolutionopen => moved
2016-08-12 09:55Kitware RobotAssigned To => Kitware Robot

Notes
(0013892)
dbarbier   
2008-10-16 06:45   
IMHO this check could be moved into vtkJavaGetId to protect both methods
(0013920)
dbarbier   
2008-10-23 04:29   
In fact this bug had been fixed in CVS 1.63 few days before being reported, and has now been push into 5.2 branch, it can be closed.
(0037016)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.