ソースを参照

Fix qDebug operator to handle case when VTKObject is null

In case the debug statement is used in the destructor, this commit
will prevent the application from crashing.
Jean-Christophe Fillion-Robin 11 年 前
コミット
ef27cafbfc
共有1 個のファイルを変更した1 個の追加1 個の削除を含む
  1. 1 1
      Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

+ 1 - 1
Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

@@ -238,7 +238,7 @@ QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection)
   const ctkVTKConnectionPrivate* d = connection.d_func();
   const ctkVTKConnectionPrivate* d = connection.d_func();
   dbg.nospace() << "ctkVTKConnection:" << &connection << endl
   dbg.nospace() << "ctkVTKConnection:" << &connection << endl
                 << "Id:" << d->Id << endl
                 << "Id:" << d->Id << endl
-                << " VTKObject:" << d->VTKObject->GetClassName()
+                << " VTKObject:" << (d->VTKObject ? d->VTKObject->GetClassName() : "<null>")
                 << "(" << d->VTKObject << ")" << endl
                 << "(" << d->VTKObject << ")" << endl
                 << " QtObject:" << d->QtObject << endl
                 << " QtObject:" << d->QtObject << endl
                 << " VTKEvent:" << d->VTKEvent << endl
                 << " VTKEvent:" << d->VTKEvent << endl