[vtkusers] Error while close the VTK Window

Sebastien Jourdain sebastien.jourdain at kitware.com
Mon May 23 10:00:09 EDT 2011


Hi Sathish,

you didn't understand what I was saying. The point was to remove all
the code to clean the vtkPanel by simply calling Delete() on the
vtkPanel itself and nothing more. No more remove actors...
But it doesn't matter. Because for that particular case where several
vtkPanel are involved in the same frame I managed to get the same
crash as you did on Linux. Which was not the case for me when I was
working on Mac.

Seb

On Mon, May 23, 2011 at 9:53 AM, Sathish Kumar <kingvsk at aol.com> wrote:
> Hi Sebastien,
>
> I tried Delete() method for all the VTK objects. But the application crashes
> while call vpanAxial.getRenderer().Delete();
>
> Thanks,
> Sathish
>
> On Monday 23 May 2011 07:00 PM, Sebastien Jourdain wrote:
>>
>> Hi Sathish,
>>
>> I gave a try on my linux and I was able to reproduce the issue with
>> the DicomMPR2D but not with the other components.
>> Something weird seems to happen for that particular application that
>> use several vtkPanel in the same view.
>> I'll try to understand what is wrong there...
>>
>> Seb
>>
>> On Mon, May 23, 2011 at 7:48 AM, Sebastien Jourdain
>> <sebastien.jourdain at kitware.com>  wrote:
>>>
>>> Hi Sathish,
>>>
>>> if you tried the VTK that I was referring too, you could not have used
>>> that code because the class vtkGlobalJavaHash does not exist anymore.
>>> And you should have a Delete() method on the vtkPanel...
>>>
>>> Seb
>>>
>>> On Mon, May 23, 2011 at 2:24 AM, Sathish Kumar<kingvsk at aol.com>  wrote:
>>>>
>>>> Hi Sebastien,
>>>>
>>>> I accept your point. But it works without memory leak. Thats why I
>>>> choosed
>>>> DeleteAll() method. Anyway here after I won't use that.
>>>>
>>>> As per your suggestion I tried the following code in Windows.
>>>> This too gives the same error window which is attached in the previous
>>>> mail.
>>>>
>>>> private void formWindowClosed(java.awt.event.WindowEvent evt)
>>>> {
>>>>         // Garbage Collection...
>>>>         vpanAxial.GetRenderer().RemoveAllViewProps();
>>>>         vpanAxial.GetRenderer().RemoveAllLights();
>>>>
>>>> vpanAxial.GetRenderWindow().RemoveRenderer(vpanAxial.GetRenderer());
>>>>         vpanAxial = null;
>>>>         vpanCoronal.GetRenderer().RemoveAllViewProps();
>>>>         vpanCoronal.GetRenderer().RemoveAllLights();
>>>>
>>>> vpanCoronal.GetRenderWindow().RemoveRenderer(vpanCoronal.GetRenderer());
>>>>         vpanCoronal = null;
>>>>         vpanSagittal.GetRenderer().RemoveAllViewProps();
>>>>         vpanSagittal.GetRenderer().RemoveAllLights();
>>>>
>>>>
>>>> vpanSagittal.GetRenderWindow().RemoveRenderer(vpanSagittal.GetRenderer());
>>>>         vpanSagittal = null;
>>>>
>>>>         resliceAxial = null;
>>>>         resliceCoronal = null;
>>>>         resliceSagittal = null;
>>>>         actorAxial = null;
>>>>         actorCoronal = null;
>>>>         actorSagittal = null;
>>>>         reader = null;
>>>>
>>>>         System.gc();
>>>>         vtkGlobalJavaHash.GC();
>>>>     }
>>>>
>>>> Thanks,
>>>> Sathish
>>>>
>>>>
>>>>
>>>> On Saturday 21 May 2011 07:07 PM, Sebastien Jourdain wrote:
>>>>
>>>> Hi Sathish,
>>>>
>>>> You can give a try with that VTK. But for sure, you shouldn't call
>>>> DeleteAll() because your Frame/Panel is still alive in the Java world.
>>>>
>>>>
>>>> http://review.source.kitware.com/#q,status:open+project:VTK+branch:master+topic:vtk-java-improvement,n,z
>>>>
>>>> Seb
>>>>
>>>> PS: I didn't had the time yet to give a try of your code on my linux.
>>>> PS2: You have to use the VTK garbage collector. Look at the code
>>>> sample provided in the source...
>>>>
>>>> On Sat, May 21, 2011 at 1:47 AM, Sathish Kumar<kingvsk at aol.com>  wrote:
>>>>
>>>> Hi All,
>>>>
>>>> I am using VTK Java Wrapper. In Windows I get an error window while I
>>>> close
>>>> my vtkRenderWindow.
>>>>
>>>> My Code :
>>>>
>>>>    private void formWindowClosed(java.awt.event.WindowEvent evt) {
>>>>        // Garbage Collection...
>>>>        vtkGlobalJavaHash.DeleteAll();
>>>>    }
>>>>
>>>> If I delete the VTK objects Manually then it results in memory leak. But
>>>> the
>>>> DeleteAll() method solves the memory leak but gives the following error
>>>> Message is a separate VTK Output Window. (Please find the attachment).
>>>>
>>>> Error: In ..\..\VTKSources\Rendering\vtkWin32OpenGLRenderWindow.cxx
>>>> vtkWin32OpenGLRenderWindow (047E5DA0): wglMakeCurrent failed in clean
>>>>
>>>> I can't scroll the error window to view further error message.
>>>>
>>>> Thanks in Advance,
>>>>
>>>> --
>>>> Sathish,
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>
>>>>
>>>>
>>>>
>
>



More information about the vtkusers mailing list