[vtkusers] RE:Comment on: *The solution* Re: Access violations in MFC sample

João Filipe de Castro Ferreira jfilipe at isr.uc.pt
Wed Dec 12 07:55:43 EST 2001


Dear Andrew:

 The code snippets I sent you were *my solution*, not the original sample.

To both Andrew and Sebastien:

 To better understand the messages I (and others) get, please refer to
http://public.kitware.com/pipermail/vtkusers/2000-November/005038.html. To
trace the problem, turn on exception handling on your debuggers for access
violations and you will see that, on the original sample, the offending line
is "this->RenderWindow->WindowInitialize();" on the OnCreate override of
vtkMFCRenderView. With my solution, no exceptions, and undoubtly no memory
leaks, occur.

To Sebastien:

 My guess is that Andrew is right - your problem lies elsewhere.


												Cheers everybody,
													JFC

-----Mensagem original-----
De: Andrew J. P. Maclean [mailto:a.maclean at acfr.usyd.edu.au]
Enviada: terça-feira, 11 de Dezembro de 2001 22:48
Para: 'Sebastien BARRE'
Cc: 'Joco Filipe de Castro Ferreira'; 'Lista do VTK'
Assunto: RE: [vtkusers] RE:Comment on: *The solution* Re: Access
violations in MFC sample


It is somewhere else in the code. I am using the classes
vtkMFCRenderView, vtkMFCView, vtkMFCDocument in my code with no memory
leaks at all. In the example you have provided, the debugger is
referring to vtkOpenGLLight.

___________________________________________
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/
___________________________________________


-----Original Message-----
From: Sebastien BARRE [mailto:sebastien.barre at kitware.com]
Sent: Wednesday, 12 December 2001 09:38
To: a.maclean at acfr.usyd.edu.au
Cc: 'Joco Filipe de Castro Ferreira'; 'Lista do VTK'
Subject: Re: [vtkusers] RE:Comment on: *The solution* Re: Access
violations in MFC sample

At 12/12/2001 09:22 AM, Andrew J. P. Maclean wrote:
>This is strange. In int vtkMFCRenderView::OnCreate(LPCREATESTRUCT
>lpCreateStruct)
>I have:
>{
>   if (vtkMFCView::OnCreate(lpCreateStruct) == -1)
>     return -1;
>
>   // TODO: Add your specialized creation code here
>   this->RenderWindow->SetParentId(lpCreateStruct->hwndParent);
>   this->RenderWindow->SetWindowId(this->m_hWnd);
>   this->RenderWindow->WindowInitialize();
>   return 0;
>}
>
>The key is to call vtkMFCView::OnCreate(...) before setting the
>Parent/Window ID and then initializing.

I do not see any difference between this code and the current CVS code.

>As I said, I have no access violations at all with the above paradigm.
>After checking with the debugger, everything seems to be initialized
and
>allocated correctly.

Build -> Start Debug -> Go
then exit the example

Look at the debug win:
Detected memory leaks!
Dumping objects ->
{713} normal block at 0x07291BC8, 15 bytes long.
  Data: <vtkOpenGLLight > 76 74 6B 4F 70 65 6E 47 4C 4C 69 67 68 74 00
{712} normal block at 0x07291888, 12 bytes long.


--
Sebastien Barre




More information about the vtkusers mailing list