Dear all,<br><br>For some time now, I am having problems with the destruction of QVTKWidgets and vtkRenderers. Originally it popped up in a large application whenever a window was destroyed, but I have since reduced it to the following small example:<br>
<br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;QVTKWidget.h&quot;<br><br>#include &lt;QApplication&gt;<br><br>int main( int argc, char* argv[] )<br>{<br>    QApplication app( argc, argv );<br>
    <br>    QVTKWidget w;<br>    w.resize( 400, 300 ); <br>    <br>    vtkRenderer* renderer = vtkRenderer::New( );<br>    w.GetRenderWindow( )-&gt;AddRenderer( renderer ); // Without this line, no heap corruption.<br>    renderer-&gt;Delete( );<br>
<br>    w.show( );<br>    app.exec( );<br>    // After this line (exiting scope) heap corruption occurs.<br>}<br><br><br>When the line adding the renderer is commented, everything works okay (except for garbage output in the window). With that renderer added, upon closing the widget (using the close-button in the top right), the application should exit, but in Visual Studio 9 2008, it complains about Heap corruption with the following message:<br>
<br>    Windows has triggered a breakpoint in try_Interactions.exe.<br>    This may be due to a corruption of the heap, which indicates a bug in try_Interactions.exe or any of the DLLs it has loaded.<br>    This may also be due to the user pressing F12 while try_Interactions.exe has focus.<br>
    The output window may have more diagnostic information.<br>    <br>And it encounters a breakpoint in crt0dat.c @ line 732 in the end of the __crtExitProcess( int ) method.<br><br>Unfortunately, it is not always as easy to reproduce. I am using Qt 4.5 with Vtk 5.4.2 on Windows XP with Visual Studio 2008, but I have seen similar behaviour before with Qt 4.4 and Qt 5.2.x<br>
<br>Windows XP  with Visual Studio 2008<br>Using Vtk 5.4.2  with  Qt 4.5.0<br><br>Although I have seen similar behaviour with Qt 4.4 and Vtk 5.2.x and also with vtkRenderWindows and vtkRenderWindowInteractors instead of QVTK.<br>
Has anyone seen this behaviour before and knows how to solve this? <br><br>Kind Regards,<br>Andre Prins<br>