<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.5296.0" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>My java application crashes when the GC finalizes a
rendering window.<BR>The problem can be reproduced with the Java examples of
<BR><A
href="http://ij-plugins.sourceforge.net/vtk-examples/index.html">http://ij-plugins.sourceforge.net/vtk-examples/index.html</A></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>The examples must be modified in order to remove
all references to the rendering window and its component.</FONT></DIV>
<DIV><SPAN class=834504612-19052006></SPAN><FONT face=Arial size=2>O<SPAN
class=834504612-19052006>hterwise the GC would not free them. </SPAN>I modified
vtkCanvas and added the following lines:<BR></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face="Courier New"> public
void removeNotify() {<BR>
super.removeNotify();<BR>
ren=null;<BR> cam =
null;<BR> lgt =
null;<BR>
rw=null;<BR>
iren=null;<BR> }<BR></FONT> <BR>I added a
System.out.println in the finalize of the vtkObjectBase, to be able to trace
easily the finalized objects.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>When the GC finalizes the
vtkGenericRenderWindowInteractor or the vtkRenderWindow,<BR>the java program
exits with the following error:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><FONT
face="Courier New">Finalize:vtk.vtkRenderWindow<BR>Finalize:vtk.vtkGenericRenderWindowInteractor<BR>#<BR>#
An unexpected error has been detected by HotSpot Virtual
Machine:<BR>#<BR># EXCEPTION_ACCESS_VIOLATION (0xc0000005) at
pc=0x00000000, pid=4844, tid=4488<BR>#<BR># Java VM: Java HotSpot(TM) Client VM
(1.4.2_11-b06 mixed mode)<BR># Problematic frame:<BR># C
0x00000000<BR>#<BR># An error report file with more information is saved as
hs_err_pid4844.log<BR>#<BR># If you would like to submit a bug report, please
visit:<BR># </FONT><A
href="http://java.sun.com/webapps/bugreport/crash.jsp"><FONT
face="Courier New">http://java.sun.com/webapps/bugreport/crash.jsp</FONT></A><BR><FONT
face="Courier New">#</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>In the vtk logs, the following error is
reported:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2>ERROR: In
\working\tools\Vtk5.0\Rendering\vtkWin32OpenGLRenderWindow.cxx, line
238<BR>vtkWin32OpenGLRenderWindow (08E6C540): wglMakeCurrent failed in
MakeCurrent(), error: The handle is invalid.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>When I trace the C Code, I find that the program
exits in the call to glDisable((GLenum)cur_light),<BR>in the following
function:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2>void
vtkWin32OpenGLRenderWindow::Clean()<BR>{<BR> vtkRenderer *ren;<BR>
GLuint id;<BR> <BR> /* finish OpenGL rendering */<BR> if
(this->ContextId) <BR> {<BR>
this->MakeCurrent();</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> /* first delete all the
old lights */<BR> for (short cur_light = GL_LIGHT0; cur_light
< GL_LIGHT0+VTK_MAX_LIGHTS; cur_light++)<BR>
{<BR>
glDisable((GLenum)cur_light);<BR>
}<BR> <BR>...</FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834504612-19052006>I tried to remove
all props from the rendering window before its finalisation, but it does not
help.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can anybody help me? With a patch, a workaround or
some advice.</FONT></DIV>
<DIV><FONT face=Arial></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in adavance!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Laurent <BR></FONT></DIV></BODY></HTML>