Null pointer dereference in ~vtkRenderWindow
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
At line 125 of file vtkRenderWindow.cxx The command this->PainterDeviceAdapter->Delete(); causes a null pointer dereference, because this->PainterDeviceAdapter is null.
Reason: In line 82, this->PainterDeviceAdapter = vtkPainterDeviceAdapter::New(); yields null, because vtkPainterDeviceAdapter.cxx is designed and documented to do just that.
Fix:
Either 1) In line 29 of vtkPainterDeviceAdapter.cxx, replace the default macro definition with this: #ifndef vtkAbstractObjectFactoryNewMacro #error You must redefine macro vtkAbstractObjectFactoryNewMacro before including this header #endif
or 2) In line 123ff of vtkRenderWindow.cxx, prepare the destructor for the null pointer case:
if (Renderers != nullptr) Renderers->Delete();
if (PainterDeviceAdapter != nullptr) PainterDeviceAdapter->Delete();
BTW.: Is it really necessary to make the code so extraordinary verbose by prefixing all members with "this->"?