ソースを参照

ctkVTKAbstractView: Skip rendering if widget is not valid

Jean-Christophe Fillion-Robin 7 年 前
コミット
71c631511c
共有1 個のファイルを変更した8 個の追加0 個の削除を含む
  1. 8 0
      Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp

+ 8 - 0
Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp

@@ -219,6 +219,14 @@ void ctkVTKAbstractView::forceRender()
 {
   Q_D(ctkVTKAbstractView);
 
+  // avoid calling render if the widget isn't valid, i.e. if the context isn't
+  // ready yet. This is due to asynchronous initialization of the context by
+  // the pqQVTKWidgetBase class.
+  if (!d->VTKWidget->isValid())
+    {
+    return;
+    }
+
   if (this->sender() == d->RequestTimer  &&
       !d->RequestTime.isValid())
     {