[vtkusers] Heap corruptions upon destruction of RenderWindow

André Prins a.h.prins at gmail.com
Mon Jun 22 08:51:29 EDT 2009


Dear all,

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:

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "QVTKWidget.h"

#include <QApplication>

int main( int argc, char* argv[] )
{
    QApplication app( argc, argv );

    QVTKWidget w;
    w.resize( 400, 300 );

    vtkRenderer* renderer = vtkRenderer::New( );
    w.GetRenderWindow( )->AddRenderer( renderer ); // Without this line, no
heap corruption.
    renderer->Delete( );

    w.show( );
    app.exec( );
    // After this line (exiting scope) heap corruption occurs.
}


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:

    Windows has triggered a breakpoint in try_Interactions.exe.
    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.
    This may also be due to the user pressing F12 while try_Interactions.exe
has focus.
    The output window may have more diagnostic information.

And it encounters a breakpoint in crt0dat.c @ line 732 in the end of the
__crtExitProcess( int ) method.

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

Windows XP  with Visual Studio 2008
Using Vtk 5.4.2  with  Qt 4.5.0

Although I have seen similar behaviour with Qt 4.4 and Vtk 5.2.x and also
with vtkRenderWindows and vtkRenderWindowInteractors instead of QVTK.
Has anyone seen this behaviour before and knows how to solve this?

Kind Regards,
Andre Prins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090622/678e6649/attachment.htm>


More information about the vtkusers mailing list