[vtkusers] VTK & MFC/MDI Problems

Andrew J. P. Maclean a.maclean at acfr.usyd.edu.au
Tue Jan 22 22:17:40 EST 2002


There seem to be problems with the MFC sample in
\VTK\Examples\GUI\Win32\SampleMFC. I am using the VTK4.x Nightly Source
from 22-Jan-2002 and compiling everything on Windows XP with MSVC SP5.

 

1) The first relates to the fact that there are considerable memory
leaks occurring. If the code is compiled (MSVC/SP5) we get the following
leaks from these objects upon exit (don't put the mouse in the window
and click on it):

vtkProperty2D, vtkCoordinate, vtkActor2D, vtkWin32OpenGLTextMapper,
vtkWin32OutputWindow, TimerLog all have instances still around.

It is my guess, but these objects do not seem to be deleting themselves
on exit.

 

2) More seriously, when the code is compiled if the mouse button is
clicked in an active window, then the program generates an Access
Violation on exit, in 

void vtkWin32OpenGLTextMapper::ReleaseGraphicsResources(vtkWindow *win) 

at the line:

      win->MakeCurrent();

 

I think this is because win is no longer a valid object. So clearly
there are problems relating to cleanup of objects upon exit.

If we comment out:

  if (this->RenderWindow) this->RenderWindow->Delete(); 

in:

vtkMFCRenderView::~vtkMFCRenderView()

then the access violation does not occur, but (obviously) there are many
more memory leaks upon exit.

 

It is my opinion that there are problems with the vtkMFC*.cpp and
vtkMFC*.h files and vtkWin32OpenGLRenderWindow

1)       Has anyone got any ideas as to what the problem is?

2)       Can anyone fix it? 

 

As a matter of interest, SimpleCXX compiles and runs OK with no memory
leaks.

 

Thanks Andrew

 


___________________________________________
Andrew J. P. Maclean


Postal:

Australian Centre for Field Robotics
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA


Room:

106


Phone:

+61 2 9351 3283


Fax:

+61 2 9351 7474


 

 <http://www.acfr.usyd.edu.au/> http://www.acfr.usyd.edu.au/

___________________________________________

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020123/30e43526/attachment.htm>


More information about the vtkusers mailing list