Commit 622ec044 authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot
Browse files

Merge topic 'disconnect-window-from-renderer'

4720d22a BUG: Set renderer's RenderWindow to NULL in RemoveRenderer.
parents 46b6ca35 4720d22a
......@@ -74,14 +74,13 @@ vtkCocoaRenderWindow::~vtkCocoaRenderWindow()
this->ShowCursor();
}
this->Finalize();
vtkRenderer *renderer;
vtkCollectionSimpleIterator rsit;
for ( this->Renderers->InitTraversal(rsit);
(renderer = this->Renderers->GetNextRenderer(rsit));)
vtkRenderer *ren;
vtkCollectionSimpleIterator rit;
this->Renderers->InitTraversal(rit);
while ( (ren = this->Renderers->GetNextRenderer(rit)) )
{
renderer->SetRenderWindow(0);
ren->SetRenderWindow(NULL);
}
if (this->Capabilities)
......@@ -89,7 +88,7 @@ vtkCocoaRenderWindow::~vtkCocoaRenderWindow()
delete[] this->Capabilities;
this->Capabilities = 0;
}
// Release the cocoa object manager.
this->SetCocoaManager(NULL);
}
......
......@@ -29,11 +29,10 @@ vtkGenericOpenGLRenderWindow::~vtkGenericOpenGLRenderWindow()
{
this->Finalize();
vtkRenderer* ren;
this->Renderers->InitTraversal();
for ( ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject());
ren != NULL;
ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject()))
vtkRenderer *ren;
vtkCollectionSimpleIterator rit;
this->Renderers->InitTraversal(rit);
while ( (ren = this->Renderers->GetNextRenderer(rit)) )
{
ren->SetRenderWindow(NULL);
}
......
......@@ -115,18 +115,16 @@ vtkOSOpenGLRenderWindow::~vtkOSOpenGLRenderWindow()
{
// close-down all system-specific drawing resources
this->Finalize();
vtkRenderer* ren;
this->Renderers->InitTraversal();
for ( ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject());
ren != NULL;
ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject()) )
vtkRenderer *ren;
vtkCollectionSimpleIterator rit;
this->Renderers->InitTraversal(rit);
while ( (ren = this->Renderers->GetNextRenderer(rit)) )
{
ren->SetRenderWindow(NULL);
}
delete this->Internal;
}
// End the rendering process and display the image.
......
......@@ -92,6 +92,18 @@ vtkRenderWindow::~vtkRenderWindow()
delete [] this->ResultFrame;
this->ResultFrame = NULL;
}
vtkCollectionSimpleIterator rsit;
this->Renderers->InitTraversal(rsit);
vtkRenderer *aren;
while ( (aren = this->Renderers->GetNextRenderer(rsit)) )
{
if (aren->GetRenderWindow() == this)
{
vtkErrorMacro("Window destructed with renderer still associated with it!");
}
}
this->Renderers->Delete();
this->PainterDeviceAdapter->Delete();
......@@ -763,6 +775,10 @@ void vtkRenderWindow::RemoveRenderer(vtkRenderer *ren)
{
// we are its parent
this->Renderers->RemoveItem(ren);
if (ren->GetRenderWindow() == this)
{
ren->SetRenderWindow(NULL);
}
}
int vtkRenderWindow::HasRenderer(vtkRenderer *ren)
......
......@@ -60,11 +60,11 @@ vtkWin32OpenGLRenderWindow::vtkWin32OpenGLRenderWindow()
vtkWin32OpenGLRenderWindow::~vtkWin32OpenGLRenderWindow()
{
this->Finalize();
vtkRenderer *ren;
vtkCollectionSimpleIterator rsit;
for (this->Renderers->InitTraversal(rsit);
(ren = this->Renderers->GetNextRenderer(rsit));)
vtkCollectionSimpleIterator rit;
this->Renderers->InitTraversal(rit);
while ( (ren = this->Renderers->GetNextRenderer(rit)) )
{
ren->SetRenderWindow(NULL);
}
......
......@@ -442,18 +442,16 @@ vtkXOpenGLRenderWindow::~vtkXOpenGLRenderWindow()
{
// close-down all system-specific drawing resources
this->Finalize();
vtkRenderer* ren;
this->Renderers->InitTraversal();
for ( ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject());
ren != NULL;
ren = vtkOpenGLRenderer::SafeDownCast(this->Renderers->GetNextItemAsObject()) )
vtkRenderer *ren;
vtkCollectionSimpleIterator rit;
this->Renderers->InitTraversal(rit);
while ( (ren = this->Renderers->GetNextRenderer(rit)) )
{
ren->SetRenderWindow(NULL);
}
delete this->Internal;
}
// End the rendering process and display the image.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment