[vtkusers] Bug in vtkDataArray.cxx; was: Bug in vtkWin32OpenGLRenderWindow when using own Interactor and windowhandle
Roland Schwarz
roland.schwarz at chello.at
Wed Mar 20 01:57:52 EST 2002
This applies to:
vtkWin32OpenGLRenderWindow.cxx Rev. 1.81
===================================
> >> By the way, I was wondering... Is this list the appropriate place to
> >> post bugreports?
> >> I have posted another bugreport to this list a month ago about a bug in
> >> vtkWin32OpenGLRenderWindow but I still haven't received any response on
> >> that e-mail.
That is very interesting: I messed around with the 'Win32SampleMFC' example
for a while and came to a different solution:
I explicitely removed all actors from the renderer on window destruction
(which does a ReleaseGraphicsResources in the right place).
Then I explicitely called this->RenderWindow->Clean(), before I noticed that
calling Clean allone is sufficient.
I also do not see a reason why the call to Clean should'nt be in the
destructor unconditionally. It must be called anyway.
One exception of course would be when the MFChandledWindow flag is true, in
which case the embedding window has more responsibility for the
RenderWindow.
Restating your post I would recommend the following addition:
if (this->WindowId && !this->MFChandledWindow) /* MFC flag added to
suggested bug fix from Sander Niemeijer */
{
this->Clean();
if (this->OwnWindow)
{
ReleaseDC(this->WindowId, this->DeviceContext);
// can't set WindowId=NULL, needed for DestroyWindow
this->DeviceContext = NULL;
// clear the extra data before calling destroy
SetWindowLong(this->WindowId,4,(LONG)0);
DestroyWindow(this->WindowId);
}
}
(Hopefully someone of the developers will have a look on our postings.)
BTW.: This also removes the crash of the Win32SampleMFC example program.
Roland
More information about the vtkusers
mailing list