[vtkusers] Solution: Bug in SetRenderWindow(NULL)

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Tue Oct 28 04:15:33 EST 2003


I guess there was a too high traffic and this mail wasn't seen. On 
behalf of Ingo, I am resending it.
Again, this patch has been tested on Windows and it *does* not only fix 
the bug to SetRenderWindow(NULL), but also it clears the memory properly.

mathieu
Ps: valgrind was not meant to be use on other os than linux. Does purify 
report this kind of mem leakage ?

de Boer Ingo wrote:
> Hi,
> 
> I guess I found the solution for the
> bug/problem in SetRenderWindow(NULL).
> The lines in vtkWin32OpenGLRenderWindow should be:
> 
> vtkWin32OpenGLRenderWindow::~vtkWin32OpenGLRenderWindow()
> {
> ...
>   if (this->WindowId)
>     {
>       this->Clean();
>       ReleaseDC(this->WindowId, this->DeviceContext);
>       // can't set WindowId=NULL, needed for DestroyWindow
>       this->DeviceContext = NULL;
>     
>       // clear the extra data before calling destroy
>       vtkSetWindowLong(this->WindowId,4,(LONG)0);
>       if (this->OwnWindow)
>         DestroyWindow(this->WindowId);
>     }
> ...
> }


Hi all,

	I have just checked Ingo's patch on my software. And it does fix the
previous problem I reported here:

	http://vtk.org/pipermail/vtkusers/2003-October/020528.html

	I do not need anymore to call 'SetRenderWindow(NULL)' before destroying 
a RenderWindow on Win32.

	I would really like this patch being applyied in the current VTK CVS 
tree. If possible I'll try builing valgrind on cygwin to check
everything is being free...not sure it'll work though...

mathieu
Ps: I include a more 'formal' patch to this problem.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32.patch
Type: text/x-diff
Size: 870 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031028/7a631c24/attachment.patch>


More information about the vtkusers mailing list