exporting Catalyst scripts with multiple layouts crashes the gui
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
If there's more than a single layout in the ParaView GUI, is there a rendering context for each of them available all of the time? When using the CoProcessing plugin it crashes if I have more than one layout in the GUI when I try to export the Python script. The crash occurs in pqImageOutputInfo::setupScreenShotInfo() (shown below) because result is NULL which results from this->View->captureImage(thumbnailSize) returning NULL. So basically, is there a simple way to change the way we capture an image of a view if the view is in a "non-active" layout?
107 //----------------------------------------------------------------------------- 108 void pqImageOutputInfo::setupScreenshotInfo() 109 { 110 this->Info.thumbnailLabel->setVisible(true); 111 if(!this->View) 112 { 113 cerr << "no view available which seems really weird\n"; 114 return; 115 } 116 117 QSize viewSize = this->View->getSize(); 118 QSize thumbnailSize; 119 if(viewSize.width() > viewSize.height()) 120 { 121 thumbnailSize.setWidth(100); 122 thumbnailSize.setHeight(100viewSize.height()/viewSize.width()); 123 } 124 else 125 { 126 thumbnailSize.setHeight(100); 127 thumbnailSize.setWidth(100viewSize.width()/viewSize.height()); 128 } 129 vtkSmartPointer image; 130 image.TakeReference(this->View->captureImage(thumbnailSize)); 131 vtkNew pngWriter; 132 pngWriter->SetInputData(image); 133 pngWriter->WriteToMemoryOn(); 134 pngWriter->Update(); 135 pngWriter->Write(); 136 vtkUnsignedCharArray* result = pngWriter->GetResult(); 137 QPixmap thumbnail; 138 thumbnail.loadFromData( 139 result->GetPointer(0), 140 result->GetNumberOfTuples()*result->GetNumberOfComponents(), "PNG"); 141 142 this->Info.thumbnailLabel->setPixmap(thumbnail); 143 }