[vtkusers] vtkRenderWindow memory access error

shock8 shock8 at donguri.sakura.ne.jp
Thu Feb 7 07:47:31 EST 2002


hi vtk gurus

I think i found a bug in vtkRenderWindow::UnRegister of release candidate.

when closing a vtkRenderWindow with Interactor
a memory violence occur.
If it is already corrected, then please forget

In this code fragment of vtkRenderWindow::UnRegister()
  this->vtkObject::UnRegister(o);
  vtkRenderWindowInteractor *tmp = this->Interactor;
  tmp->Register(0);
  this->Interactor->SetRenderWindow(NULL); // destructor of vtkRenderWindow
is called at this point
  tmp->UnRegister(0); // vtkRenderWindow is called after destruction!!!

tmp->UnRegister(0)
calls
  vtkRenderWindowInteractor->~vtkRenderWindowInteractor()
calls
  InteractorStyle->UnRegister(this)
calls
  vtkInteractorStyle::~vtkInteractorStyle()
calls
  vtkInteractorStyleSwitch::~vtkInteractorStyleSwitch()
calls
  vtkInteractorStyleJoystickCamera::~vtkInteractorStyleJoystickCamera()
calls
  this->CurrentRenderer->UnRegister(this);
calls
void vtkRenderer::SetRenderWindow(vtkRenderWindow *renwin)
{
  vtkProp *aProp;

  if (renwin != this->RenderWindow) // this->RenderWindow is already
deleted!!!!!!!!!
    {
    this->Props->InitTraversal();
    for ( aProp = this->Props->GetNextProp();
          aProp != NULL;
          aProp = this->Props->GetNextProp() )
      {
      aProp->ReleaseGraphicsResources(this->RenderWindow);  // ERROR
      }
    }
  this->VTKWindow = renwin;
  this->RenderWindow = renwin;
}






More information about the vtkusers mailing list