XMLWriter segfaults when trying to set CompressorTypoe to ZLIB
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Start pvpython (paraview version 3.7.0, Date: 2009-10-01, 32-bit Linux) and execute the following code: from paraview.simple import *; Cylinder1 = Cylinder(); CleantoGrid1 = CleantoGrid() writer = servermanager.writers.XMLUnstructuredGridWriter(FileName="foo.vtu", DataMode=2, Input=CleantoGrid1, CompressorType=1);
and you'll get a segfault. It does not occur when setting CompressorType=0. (BTW: I could not find a regression test that checks this.)
gdb reveals a null pointer dereference:
Program received signal SIGSEGV, Segmentation fault. 0xaf29c93a in vtkXMLWriter::SetCompressorType (this=0x8f988f0, compressorType=1) at /data/ParaView3_Git/VTK/IO/vtkXMLWriter.cxx:298 298 this->Compressor->Delete(); (gdb) list 293 294 if (compressorType == ZLIB) 295 { 296 if (!this->Compressor || !this->Compressor->IsTypeOf("vtkZLibDataCompressor")) 297 { 298 this->Compressor->Delete(); 299 this->Compressor = vtkZLibDataCompressor::New(); 300 this->Modified(); 301 } 302 return; (gdb) print this->Compressor $1 = (class vtkDataCompressor *) 0x0
A suggested patch is attached.