From 02ce1f5a15dc1f72b46f8fe3df4d5d703e5453c9 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 24 Nov 2014 18:05:25 +0300 Subject: [PATCH] Add patch for ParaView 4.2.0 --- config_files/patches/ParaView-4.2.0.patch | 1351 +++++++++++++++++++++ 1 file changed, 1351 insertions(+) create mode 100644 config_files/patches/ParaView-4.2.0.patch diff --git a/config_files/patches/ParaView-4.2.0.patch b/config_files/patches/ParaView-4.2.0.patch new file mode 100644 index 0000000..b799a38 --- /dev/null +++ b/config_files/patches/ParaView-4.2.0.patch @@ -0,0 +1,1351 @@ +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/CMakeLists.txt ParaView-4.2.0_SRC.new/CMakeLists.txt +--- ParaView-4.2.0_SRC/CMakeLists.txt 2014-09-23 18:46:43.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/CMakeLists.txt 2014-11-18 15:23:10.000000000 +0300 +@@ -543,8 +543,8 @@ + + #---------------------------------------------------------------------------------- + # Set some flags that affect VTK's modules. +- set (VTK_NO_PYTHON_THREADS 1 CACHE INTERNAL +- "Disable Python Threads support" FORCE) ++ set (VTK_NO_PYTHON_THREADS ON CACHE BOOL ++ "Disable Python Threads support") + set(VTK_WRAP_PYTHON ${PARAVIEW_ENABLE_PYTHON} + CACHE INTERNAL "Should VTK Python wrapping be built?" FORCE) + +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx +--- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkPVPythonInformation.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -100,7 +100,9 @@ + namespace { + bool hasModule(const char *module) + { ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject mod(PyImport_ImportModule(module)); ++ VTK_PY_GIL_RELEASE + bool result = mod; + return result; + } +@@ -108,11 +110,13 @@ + // Returns empty string on error. + std::string getModuleAttrAsString(const char *module, const char *attribute) + { ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject mod(PyImport_ImportModule(module)); + if (!mod) + { + std::ostringstream result; + result << "(module '" << module << "' not found)"; ++ VTK_PY_GIL_RELEASE + return result.str(); + } + +@@ -122,11 +126,13 @@ + std::ostringstream result; + result << "('" << module << "' module found, missing '" << attribute + << "' attribute)"; ++ VTK_PY_GIL_RELEASE + return result.str(); + } + + std::string result = PyBytes_AsString(attr); + ++ VTK_PY_GIL_RELEASE + return result; + } + +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkSession.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkSession.cxx +--- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Core/vtkSession.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Core/vtkSession.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -30,13 +30,15 @@ + //---------------------------------------------------------------------------- + void vtkSession::Activate() + { +- vtkProcessModule::GetProcessModule()->PushActiveSession(this); ++ if(vtkProcessModule::GetProcessModule()) ++ vtkProcessModule::GetProcessModule()->PushActiveSession(this); + } + + //---------------------------------------------------------------------------- + void vtkSession::DeActivate() + { +- vtkProcessModule::GetProcessModule()->PopActiveSession(this); ++ if(vtkProcessModule::GetProcessModule()) ++ vtkProcessModule::GetProcessModule()->PopActiveSession(this); + } + + //---------------------------------------------------------------------------- +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx +--- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -172,6 +172,7 @@ + if (geomFilter) + { + geomFilter->SetUseOutline(0); ++ geomFilter->SetTriangulate(0); + geomFilter->SetNonlinearSubdivisionLevel(1); + geomFilter->SetPassThroughCellIds(1); + geomFilter->SetPassThroughPointIds(1); +@@ -236,7 +237,7 @@ + vtkPVRenderView::MarkAsRedistributable(inInfo, this); + + // Tell the view if this representation needs ordered compositing. We need +- // ordered compositing when rendering translucent geometry. ++ // ordered compositing when rendering translucent geometry. + if (this->Actor->HasTranslucentPolygonalGeometry()) + { + // We need to extend this condition to consider translucent LUTs once we +@@ -270,7 +271,7 @@ + this->LODOutlineFilter->Update(); + // Pass along the LOD geometry to the view so that it can deliver it to + // the rendering node as and when needed. +- vtkPVRenderView::SetPieceLOD(inInfo, this, ++ vtkPVRenderView::SetPieceLOD(inInfo, this, + this->LODOutlineFilter->GetOutputDataObject(0)); + } + else +@@ -290,7 +291,7 @@ + + // Pass along the LOD geometry to the view so that it can deliver it to + // the rendering node as and when needed. +- vtkPVRenderView::SetPieceLOD(inInfo, this, ++ vtkPVRenderView::SetPieceLOD(inInfo, this, + this->Decimator->GetOutputDataObject(0)); + } + } +@@ -780,6 +781,19 @@ + } + + //---------------------------------------------------------------------------- ++void vtkGeometryRepresentation::SetTriangulate(int val) ++{ ++ if (vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter)) ++ { ++ vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter)->SetTriangulate(val); ++ } ++ ++ // since geometry filter needs to execute, we need to mark the representation ++ // modified. ++ this->MarkModified(); ++} ++ ++//---------------------------------------------------------------------------- + void vtkGeometryRepresentation::SetNonlinearSubdivisionLevel(int val) + { + if (vtkPVGeometryFilter::SafeDownCast(this->GeometryFilter)) +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h +--- ParaView-4.2.0_SRC/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ClientServerCore/Rendering/vtkGeometryRepresentation.h 2014-11-18 15:23:10.000000000 +0300 +@@ -19,7 +19,7 @@ + // It handles non-polygonal datasets by extracting external surfaces. One can + // use this representation to show surface/wireframe/points/surface-with-edges. + // .SECTION Thanks +-// The addition of a transformation matrix was supported by CEA/DIF ++// The addition of a transformation matrix was supported by CEA/DIF + // Commissariat a l'Energie Atomique, Centre DAM Ile-De-France, Arpajon, France. + + #ifndef __vtkGeometryRepresentation_h +@@ -109,7 +109,7 @@ + // Description: + // Returns true if this class would like to get ghost-cells if available for + // the connection whose information object is passed as the argument. +- static bool DoRequestGhostCells(vtkInformation* information); ++ static bool DoRequestGhostCells(vtkInformation* information); + + // Description: + // Representations that use geometry representation as the internal +@@ -122,6 +122,7 @@ + //*************************************************************************** + // Forwarded to vtkPVGeometryFilter + virtual void SetUseOutline(int); ++ void SetTriangulate(int); + void SetNonlinearSubdivisionLevel(int); + + //*************************************************************************** +@@ -145,7 +146,7 @@ + virtual void SetPosition(double, double, double); + virtual void SetScale(double, double, double); + virtual void SetTexture(vtkTexture*); +- virtual void SetUserTransform(const double[16]); ++ virtual void SetUserTransform(const double[16]); + + //*************************************************************************** + // Forwarded to Mapper and LODMapper. +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx +--- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Core/vtkSMTrace.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -69,6 +69,7 @@ + #ifdef PARAVIEW_ENABLE_PYTHON + // ensure Python interpreter is initialized. + vtkPythonInterpreter::Initialize(); ++ VTK_PY_GIL_ENSURE + this->Internals->TraceModule.TakeReference(PyImport_ImportModule("paraview.smtrace")); + if (!this->Internals->TraceModule) + { +@@ -92,6 +93,7 @@ + this->Internals->CreateItemFunction.TakeReference(NULL); + } + } ++ VTK_PY_GIL_RELEASE + #endif + } + +@@ -115,12 +117,15 @@ + + #ifdef PARAVIEW_ENABLE_PYTHON + vtkPythonInterpreter::Initialize(); ++ VTK_PY_GIL_ENSURE + try + { ++ + vtkSmartPyObject module(PyImport_ImportModule("paraview.smstate")); + if (!module || PyErr_Occurred()) + { + vtkGenericWarningMacro("Failed to import paraview.smstate module."); ++ VTK_PY_GIL_RELEASE + throw 1; + } + +@@ -132,9 +137,12 @@ + if (!result || PyErr_Occurred()) + { + vtkGenericWarningMacro("Failed to generate state."); ++ VTK_PY_GIL_RELEASE + throw 1; + } +- return vtkStdString(PyString_AsString(result)); ++ vtkStdString s(PyString_AsString(result)); ++ VTK_PY_GIL_RELEASE ++ return s; + } + catch (int) + { +@@ -144,6 +152,7 @@ + PyErr_Clear(); + } + } ++ VTK_PY_GIL_RELEASE + #endif + (void)propertiesToTraceOnCreate; + (void)skipHiddenRepresentations; +@@ -164,9 +173,11 @@ + } + else + { ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject _start_trace_internal( + PyObject_CallMethod(vtkSMTrace::ActiveTracer->GetTraceModule(), + const_cast("_start_trace_internal"), NULL)); ++ VTK_PY_GIL_RELEASE + vtkSMTrace::ActiveTracer->CheckForError(); + } + #endif +@@ -192,6 +203,7 @@ + vtkSMTrace::ActiveTracer = NULL; + + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject _stop_trace_internal( + PyObject_CallMethod(active->GetTraceModule(), const_cast("_stop_trace_internal"), NULL)); + if (active->CheckForError() == false) +@@ -199,14 +211,18 @@ + // no error. + if (Py_None != _stop_trace_internal.GetPointer() && _stop_trace_internal.GetPointer() != NULL) + { +- return vtkStdString(PyString_AsString(_stop_trace_internal)); ++ vtkStdString s(PyString_AsString(_stop_trace_internal)); ++ VTK_PY_GIL_RELEASE ++ return s; + } + else + { + vtkGenericWarningMacro("Empty trace returned!!!"); ++ VTK_PY_GIL_RELEASE + return vtkStdString(); + } + } ++ VTK_PY_GIL_RELEASE + #endif + return vtkStdString(); + } +@@ -223,13 +239,17 @@ + + #ifdef PARAVIEW_ENABLE_PYTHON + vtkSMTrace* active = vtkSMTrace::ActiveTracer; ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject get_current_trace_output( + PyObject_CallMethod(active->GetTraceModule(), const_cast("get_current_trace_output"), NULL)); + if (active->CheckForError() == false && get_current_trace_output) + { + // no error. +- return vtkStdString(PyString_AsString(get_current_trace_output)); ++ vtkStdString s(PyString_AsString(get_current_trace_output)); ++ VTK_PY_GIL_RELEASE ++ return s; + } ++ VTK_PY_GIL_RELEASE + #endif + return vtkStdString(); + } +@@ -256,6 +276,7 @@ + bool vtkSMTrace::CheckForError() + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + PyObject *exception = PyErr_Occurred(); + if (exception) + { +@@ -264,12 +285,15 @@ + // catch Untraceable exceptions. We can log them when debugging is + // enabled. + PyErr_Clear(); ++ VTK_PY_GIL_RELEASE + return false; + } + PyErr_Print(); + PyErr_Clear(); ++ VTK_PY_GIL_RELEASE + return true; + } ++ VTK_PY_GIL_RELEASE + #endif + return false; + } +@@ -336,6 +360,7 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject keyObj(PyString_FromString(key)); + vtkSmartPyObject valObj(vtkPythonUtil::GetObjectFromPointer(val)); + assert(valObj && keyObj); +@@ -343,6 +368,7 @@ + int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)key; +@@ -358,6 +384,7 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject keyObj(PyString_FromString(key)); + vtkSmartPyObject valObj; + if (val == NULL) +@@ -374,6 +401,7 @@ + int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)key; +@@ -389,6 +417,7 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject keyObj(PyString_FromString(key)); + vtkSmartPyObject valObj(PyInt_FromLong(val)); + assert(keyObj && valObj); +@@ -396,6 +425,7 @@ + int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)key; +@@ -411,6 +441,7 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject keyObj(PyString_FromString(key)); + vtkSmartPyObject valObj(PyFloat_FromDouble(val)); + assert(keyObj && valObj); +@@ -418,6 +449,7 @@ + int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)key; +@@ -432,6 +464,7 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject keyObj(PyString_FromString(key)); + vtkSmartPyObject valObj(PyBool_FromLong(val? 1 : 0)); + assert(keyObj && valObj); +@@ -439,6 +472,7 @@ + int ret = PyDict_SetItem(this->Internals->GetKWArgs(), keyObj, valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)key; +@@ -452,11 +486,13 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject valObj(vtkPythonUtil::GetObjectFromPointer(val)); + assert(valObj); + int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)val; +@@ -470,11 +506,13 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject valObj(PyString_FromString(val)); + assert(valObj); + int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)val; +@@ -487,11 +525,13 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject valObj(PyInt_FromLong(val)); + assert(valObj); + int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)val; +@@ -504,11 +544,13 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject valObj(PyFloat_FromDouble(val)); + assert(valObj); + int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)val; +@@ -521,11 +563,13 @@ + if (vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject valObj(PyBool_FromLong(val? 1 : 0)); + assert(valObj); + int ret = PyList_Append(this->Internals->GetPositionalArgs(), valObj); + (void)ret; + assert(ret == 0); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)val; +@@ -557,9 +601,11 @@ + vtkSMTrace* tracer = vtkSMTrace::GetActiveTracer(); + if (tracer && this->Internals->PyItem) + { ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject reply( + PyObject_CallMethod(this->Internals->PyItem, + const_cast("finalize"), NULL)); ++ VTK_PY_GIL_RELEASE + tracer->CheckForError(); + tracer->InvokeEvent(vtkCommand::UpdateEvent); + } +@@ -583,6 +629,7 @@ + if (vtkSMTrace* tracer = vtkSMTrace::GetActiveTracer()) + { + #ifdef PARAVIEW_ENABLE_PYTHON ++ VTK_PY_GIL_ENSURE + assert(tracer->GetTraceModule()); + assert(tracer->GetCreateItemFunction()); + +@@ -613,6 +660,7 @@ + this->Internals->PyItem.TakeReference( + PyObject_Call(tracer->GetCreateItemFunction(), args, NULL)); + tracer->CheckForError(); ++ VTK_PY_GIL_RELEASE + #endif + } + (void)arguments; +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx +--- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -276,7 +276,7 @@ + { + if (!info) + { +- vtkWarningMacro("Could not determine array range."); ++ // vtkWarningMacro("Could not determine array range."); + return false; + } + +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml +--- ParaView-4.2.0_SRC/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/ServerManager/SMApplication/Resources/views_and_representations.xml 2014-11-18 15:25:05.000000000 +0300 +@@ -2044,16 +2044,14 @@ + ++ number_of_elements="1"> + + + ++ number_of_elements="1"> + + +@@ -3139,6 +3137,8 @@ + panel_visibility="advanced" /> + ++ + + --> + + ++ ++ ++ Triangulate the geometry internally to avoid rendering ++ issues of non-convex polygons. This feature has a processing and memory ++ cost, it should be enabled only when needed. ++ + + #include + +-#define VTK_CREATE(type, name) \ +- vtkSmartPointer name = vtkSmartPointer::New() + + vtkStandardNewMacro(vtkPVGeometryFilter); + vtkCxxSetObjectMacro(vtkPVGeometryFilter, Controller, vtkMultiProcessController); +@@ -149,6 +148,7 @@ + this->UseOutline = 1; + this->UseStrips = 0; + this->GenerateCellNormals = 1; ++ this->Triangulate = false; + this->NonlinearSubdivisionLevel = 1; + + this->DataSetSurfaceFilter = vtkDataSetSurfaceFilter::New(); +@@ -1348,8 +1348,8 @@ + { + this->OutlineFlag = 0; + +- bool handleSubdivision = false; +- if (this->NonlinearSubdivisionLevel > 0) ++ bool handleSubdivision = (this->Triangulate != 0); ++ if (!handleSubdivision && (this->NonlinearSubdivisionLevel > 0)) + { + // Check to see if the data actually has nonlinear cells. Handling + // nonlinear cells adds unnecessary work if we only have linear cells. +@@ -1445,6 +1445,16 @@ + this->DataSetSurfaceFilter->UnstructuredGridExecute(input, output, updateghostlevel); + } + ++ if (this->Triangulate && (output->GetNumberOfPolys() > 0)) ++ { ++ // Triangulate the polygonal mesh if requested to avoid rendering ++ // issues of non-convex polygons. ++ vtkNew triangleFilter; ++ triangleFilter->SetInputData(output); ++ triangleFilter->Update(); ++ output->ShallowCopy(triangleFilter->GetOutput()); ++ } ++ + if (handleSubdivision) + { + // Restore state of DataSetSurfaceFilter. +@@ -1456,9 +1466,9 @@ + + // Now use vtkPVRecoverGeometryWireframe to create an edge flag attribute + // that will cause the wireframe to be rendered correctly. +- VTK_CREATE(vtkPolyData, nextStageInput); ++ vtkNew nextStageInput; + nextStageInput->ShallowCopy(output); // Yes output is correct. +- this->RecoverWireframeFilter->SetInputData(nextStageInput); ++ this->RecoverWireframeFilter->SetInputData(nextStageInput.Get()); + + // Observe the progress of the internal filter. + // TODO: Make the consecutive internal filter execution have monotonically +@@ -1489,7 +1499,7 @@ + return; + } + vtkIdType numPts = polyPtIds2FacePtIds->GetNumberOfTuples(); +- VTK_CREATE(vtkIdTypeArray, polyPtIds2OriginalPtIds); ++ vtkNew polyPtIds2OriginalPtIds; + polyPtIds2OriginalPtIds->SetName("vtkOriginalPointIds"); + polyPtIds2OriginalPtIds->SetNumberOfComponents(1); + polyPtIds2OriginalPtIds->SetNumberOfTuples(numPts); +@@ -1503,7 +1513,7 @@ + } + polyPtIds2OriginalPtIds->SetValue(polyPtId, originalPtId); + } +- output->GetPointData()->AddArray(polyPtIds2OriginalPtIds); ++ output->GetPointData()->AddArray(polyPtIds2OriginalPtIds.Get()); + } + } + +@@ -1518,7 +1528,7 @@ + + //---------------------------------------------------------------------------- + void vtkPVGeometryFilter::PolyDataExecute( +- vtkPolyData* input, vtkPolyData* out, int doCommunicate) ++ vtkPolyData* input, vtkPolyData* output, int doCommunicate) + { + if (!this->UseOutline) + { +@@ -1533,54 +1543,90 @@ + inCopy->RemoveGhostCells(1); + stripper->SetInputData(inCopy); + stripper->Update(); +- out->CopyStructure(stripper->GetOutput()); +- out->GetPointData()->ShallowCopy(stripper->GetOutput()->GetPointData()); +- out->GetCellData()->ShallowCopy(stripper->GetOutput()->GetCellData()); ++ output->CopyStructure(stripper->GetOutput()); ++ output->GetPointData()->ShallowCopy(stripper->GetOutput()->GetPointData()); ++ output->GetCellData()->ShallowCopy(stripper->GetOutput()->GetCellData()); + inCopy->Delete(); + stripper->Delete(); + } + else + { +- out->ShallowCopy(input); ++ output->ShallowCopy(input); + if (this->PassThroughCellIds) + { +- vtkIdTypeArray *originalCellIds = vtkIdTypeArray::New(); ++ vtkNew originalCellIds; + originalCellIds->SetName("vtkOriginalCellIds"); + originalCellIds->SetNumberOfComponents(1); +- vtkCellData *outputCD = out->GetCellData(); +- outputCD->AddArray(originalCellIds); +- vtkIdType numTup = out->GetNumberOfCells(); ++ vtkNew originalFaceIds; ++ originalFaceIds->SetName(vtkPVRecoverGeometryWireframe::ORIGINAL_FACE_IDS()); ++ originalFaceIds->SetNumberOfComponents(1); ++ vtkCellData *outputCD = output->GetCellData(); ++ outputCD->AddArray(originalCellIds.Get()); ++ if (this->Triangulate) ++ { ++ outputCD->AddArray(originalFaceIds.Get()); ++ } ++ vtkIdType numTup = output->GetNumberOfCells(); + originalCellIds->SetNumberOfValues(numTup); ++ originalFaceIds->SetNumberOfValues(numTup); + for (vtkIdType cId = 0; cId < numTup; cId++) + { + originalCellIds->SetValue(cId, cId); ++ originalFaceIds->SetValue(cId, cId); + } +- originalCellIds->Delete(); +- originalCellIds = NULL; + } + if (this->PassThroughPointIds) + { +- vtkIdTypeArray *originalPointIds = vtkIdTypeArray::New(); ++ vtkNew originalPointIds; + originalPointIds->SetName("vtkOriginalPointIds"); + originalPointIds->SetNumberOfComponents(1); +- vtkPointData *outputPD = out->GetPointData(); +- outputPD->AddArray(originalPointIds); +- vtkIdType numTup = out->GetNumberOfPoints(); ++ vtkPointData *outputPD = output->GetPointData(); ++ outputPD->AddArray(originalPointIds.Get()); ++ vtkIdType numTup = output->GetNumberOfPoints(); + originalPointIds->SetNumberOfValues(numTup); + for (vtkIdType pId = 0; pId < numTup; pId++) + { + originalPointIds->SetValue(pId, pId); + } +- originalPointIds->Delete(); +- originalPointIds = NULL; + } +- out->RemoveGhostCells(1); ++ ++ output->RemoveGhostCells(1); ++ ++ if (this->Triangulate) ++ { ++ // Triangulate the polygonal mesh. ++ vtkNew triangleFilter; ++ triangleFilter->SetInputData(output); ++ triangleFilter->Update(); ++ ++ // Now use vtkPVRecoverGeometryWireframe to create an edge flag attribute ++ // that will cause the wireframe to be rendered correctly. ++ this->RecoverWireframeFilter->SetInputData(triangleFilter->GetOutput()); ++ ++ // Observe the progress of the internal filter. ++ // TODO: Make the consecutive internal filter execution have monotonically ++ // increasing progress rather than restarting for every internal filter. ++ this->RecoverWireframeFilter->AddObserver( ++ vtkCommand::ProgressEvent, ++ this->InternalProgressObserver); ++ this->RecoverWireframeFilter->Update(); ++ // The internal filter finished. Remove the observer. ++ this->RecoverWireframeFilter->RemoveObserver( ++ this->InternalProgressObserver); ++ ++ this->RecoverWireframeFilter->SetInputData(NULL); ++ ++ // Get what should be the final output. ++ output->ShallowCopy(this->RecoverWireframeFilter->GetOutput()); ++ ++ output->GetCellData()->RemoveArray(vtkPVRecoverGeometryWireframe::ORIGINAL_FACE_IDS()); ++ } + } + return; + } + + this->OutlineFlag = 1; +- this->DataSetExecute(input, out, doCommunicate); ++ this->DataSetExecute(input, output, doCommunicate); + } + + //---------------------------------------------------------------------------- +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h +--- ParaView-4.2.0_SRC/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/ParaViewCore/VTKExtensions/Rendering/vtkPVGeometryFilter.h 2014-11-18 15:23:10.000000000 +0300 +@@ -85,6 +85,13 @@ + vtkBooleanMacro(GenerateCellNormals, int); + + // Description: ++ // Whether to triangulate mesh for rendering. This parameter avoid ++ // rendering issues of non-convex polygons. ++ vtkSetMacro(Triangulate, int); ++ vtkGetMacro(Triangulate, int); ++ vtkBooleanMacro(Triangulate, int); ++ ++ // Description: + // Nonlinear faces are approximated with flat polygons. This parameter + // controls how many times to subdivide nonlinear surface cells. Higher + // subdivisions generate closer approximations but take more memory and +@@ -101,8 +108,7 @@ + // Description: + // If on, the output polygonal dataset will have a celldata array that + // holds the cell index of the original 3D cell that produced each output +- // cell. This is useful for picking. The default is off to conserve +- // memory. ++ // cell. This is useful for picking but it takes memory. The default is on. + void SetPassThroughCellIds(int); + vtkGetMacro(PassThroughCellIds,int); + vtkBooleanMacro(PassThroughCellIds,int); +@@ -110,8 +116,7 @@ + // Description: + // If on, the output polygonal dataset will have a pointdata array that + // holds the point index of the original vertex that produced each output +- // vertex. This is useful for picking. The default is off to conserve +- // memory. ++ // vertex. This is useful for picking but it takes memory. The default is on. + void SetPassThroughPointIds(int); + vtkGetMacro(PassThroughPointIds,int); + vtkBooleanMacro(PassThroughPointIds,int); +@@ -176,7 +181,7 @@ + virtual vtkExecutive* CreateDefaultExecutive(); + + // Description: +- // Produce geometry for a block in the dataset. ++ // Produce geometry for a block in the dataset. + // This does not handle producing outlines. Call only when this->UseOutline == + // 0; \c extractface mask it is used to determine external faces. + void ExecuteAMRBlock(vtkUniformGrid* input, +@@ -250,6 +255,7 @@ + int UseOutline; + int UseStrips; + int GenerateCellNormals; ++ int Triangulate; + int NonlinearSubdivisionLevel; + + vtkMultiProcessController* Controller; +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Qt/Components/pqPropertiesPanel.cxx ParaView-4.2.0_SRC.new/Qt/Components/pqPropertiesPanel.cxx +--- ParaView-4.2.0_SRC/Qt/Components/pqPropertiesPanel.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/Qt/Components/pqPropertiesPanel.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -383,6 +383,14 @@ + this->Internals->Ui.DisplayButton->setVisible(has_multiples_types && has_display); + this->Internals->Ui.ViewButton->setVisible(has_multiples_types && has_view); + ++ // added to avoid unwanted save restore buttons ++ this->Internals->Ui.PropertiesSaveAsDefaults->setVisible(has_source); ++ this->Internals->Ui.PropertiesRestoreDefaults->setVisible(has_source); ++ this->Internals->Ui.DisplaySaveAsDefaults->setVisible(has_display); ++ this->Internals->Ui.DisplayRestoreDefaults->setVisible(has_display); ++ this->Internals->Ui.ViewSaveAsDefaults->setVisible(has_view); ++ this->Internals->Ui.ViewRestoreDefaults->setVisible(has_view); ++ + this->updatePanel(); + } + +@@ -593,14 +601,15 @@ + } + + //----------------------------------------------------------------------------- +-void pqPropertiesPanel::updateViewPanel (pqView* _view) ++void pqPropertiesPanel::updateViewPanel (pqView* argView) + { ++ pqView* _view = argView; + if ( (this->PanelMode & pqPropertiesPanel::VIEW_PROPERTIES) == 0) + { + _view = NULL; + } + +- if (this->Internals->View != _view) ++ if (this->Internals->View != argView) + { + // The view has changed. + if (this->Internals->View) +@@ -611,8 +620,8 @@ + delete this->Internals->ViewWidgets; + } + } +- this->Internals->View = _view; +- emit this->viewChanged(_view); ++ this->Internals->View = argView; ++ emit this->viewChanged(argView); + if (_view) + { + // create the widgets for this view +diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Qt/Python/pqPythonSyntaxHighlighter.cxx ParaView-4.2.0_SRC.new/Qt/Python/pqPythonSyntaxHighlighter.cxx +--- ParaView-4.2.0_SRC/Qt/Python/pqPythonSyntaxHighlighter.cxx 2014-09-23 18:46:44.000000000 +0400 ++++ ParaView-4.2.0_SRC.new/Qt/Python/pqPythonSyntaxHighlighter.cxx 2014-11-18 15:23:10.000000000 +0300 +@@ -65,6 +65,7 @@ + this->Internals->TextEdit = textEdit; + this->Internals->TextEdit->installEventFilter(this); + vtkPythonInterpreter::Initialize(); ++ VTK_PY_GIL_ENSURE + this->Internals->PygmentsModule.TakeReference(PyImport_ImportModule("pygments")); + if (this->Internals->PygmentsModule && this->Internals->TextEdit != NULL) + { +@@ -99,6 +100,7 @@ + this->connect(this->Internals->TextEdit.data(), SIGNAL(textChanged()), + this, SLOT(rehighlightSyntax())); + } ++ VTK_PY_GIL_RELEASE + this->Internals->IsSyntaxHighlighting = false; + // Replace tabs with 4 spaces + this->Internals->ReplaceTabs = true; +@@ -175,10 +177,12 @@ + } + QString leadingWhitespace = text.left(leadingWhiteSpaceLength); + QString trailingWhitespace = text.right(trailingWhiteSpaceLength); ++ VTK_PY_GIL_ENSURE + vtkSmartPyObject args(Py_BuildValue("sOO",text.trimmed().toStdString().c_str(), + this->Internals->PythonLexer.GetPointer(),this->Internals->HtmlFormatter.GetPointer())); + vtkSmartPyObject resultingText(PyObject_Call(this->Internals->HighlightFunction,args,NULL)); + const char *resultingTextAsCString = PyString_AsString(resultingText); ++ VTK_PY_GIL_RELEASE + QString pygmentsOutput(resultingTextAsCString); + // the first span tag always should follow the pre tag like this;
",pygmentsOutput.indexOf("
+ #include 
+ 
+@@ -16,7 +16,6 @@
+ #endif
+ 
+ #include 
+-
+ #include 
+ 
+ #include 
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsFilter.C ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsFilter.C
+--- ParaView-4.2.0_SRC/Utilities/VisItBridge/databases/Vs/VsFilter.C	2014-09-23 18:46:46.000000000 +0400
++++ ParaView-4.2.0_SRC.new/Utilities/VisItBridge/databases/Vs/VsFilter.C	2014-11-18 15:23:10.000000000 +0300
+@@ -1,3 +1,7 @@
++#define H5Gopen_vers 2
++#define H5Dopen_vers 2
++#define H5Eset_auto_vers 2
++#define H5Aiterate_vers 2
+ #include 
+ #include 
+ #if HDF5_VERSION_GE(1,8,1)
+@@ -146,11 +150,7 @@
+       
+       // Get info of the linked object.
+       H5O_info_t objinfo;
+-#ifndef H5_USE_16_API
+       hid_t obj_id = H5Oopen(locId, name, H5P_DEFAULT);
+-#else
+-      hid_t obj_id = H5Oopen(locId, name);        
+-#endif
+       
+       if (obj_id < 0) {
+         VsLog::errorLog() <<"VsFilter::visitLinks() - unable to get id for external object " < 0 )
+     return (double) VERDICT_MIN( aspect_ratio, VERDICT_DBL_MAX );
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/Python/vtkPython.h ParaView-4.2.0_SRC.new/VTK/Utilities/Python/vtkPython.h
+--- ParaView-4.2.0_SRC/VTK/Utilities/Python/vtkPython.h	2014-09-23 18:47:11.000000000 +0400
++++ ParaView-4.2.0_SRC.new/VTK/Utilities/Python/vtkPython.h	2014-11-18 15:23:10.000000000 +0300
+@@ -87,4 +87,14 @@
+ #error "Python.h is different version from what VTK was configured with!!"
+ #endif
+ 
++#ifdef VTK_NO_PYTHON_THREADS
++#  define VTK_PY_GIL_ENSURE
++#  define VTK_PY_GIL_RELEASE
++#else
++#  define VTK_PY_GIL_ENSURE  PyGILState_STATE _gstate_avoid_clash = PyGILState_Ensure();
++#  define VTK_PY_GIL_RELEASE PyGILState_Release(_gstate_avoid_clash);
++#
++#endif
++
++
+ #endif
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx
+--- ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx	2014-09-23 18:47:11.000000000 +0400
++++ ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx	2014-11-18 15:23:10.000000000 +0300
+@@ -45,6 +45,7 @@
+ 
+   void CleanupPythonObjects()
+     {
++    VTK_PY_GIL_ENSURE
+     Py_XDECREF(this->InteractiveConsoleLocals);
+     Py_XDECREF(this->InteractiveConsole);
+     this->InteractiveConsole = NULL;
+@@ -54,6 +55,7 @@
+       const char* code = "import gc; gc.collect()\n";
+       vtkPythonInterpreter::RunSimpleString(code);
+       }
++    VTK_PY_GIL_RELEASE
+     }
+ 
+   PyObject* GetInteractiveConsole()
+@@ -65,6 +67,7 @@
+ 
+     vtkPythonInterpreter::Initialize();
+ 
++    VTK_PY_GIL_ENSURE
+     // set up the code.InteractiveConsole instance that we'll use.
+     const char* code = "import code\n"
+       "__vtkConsoleLocals={'__name__':'__vtkconsole__','__doc__':None}\n"
+@@ -83,6 +86,7 @@
+       {
+       vtkGenericWarningMacro(
+         "Failed to locate the InteractiveConsole/InteractiveConsoleLocals object.");
++      VTK_PY_GIL_RELEASE
+       return NULL;
+       }
+     Py_INCREF(this->InteractiveConsole);
+@@ -105,7 +109,7 @@
+       PySys_SetObject(const_cast("ps2"), ps2 = PyString_FromString("... "));
+       Py_XDECREF(ps2);
+       }
+-
++    VTK_PY_GIL_RELEASE
+     return this->InteractiveConsole;
+     }
+ };
+@@ -167,6 +171,7 @@
+     i++;
+     }
+ 
++  VTK_PY_GIL_ENSURE
+   bool ret_value = false;
+   PyObject *res = PyObject_CallMethod(console,
+     const_cast("push"), const_cast("z"), buffer.c_str());
+@@ -179,6 +184,7 @@
+       }
+     Py_DECREF(res);
+     }
++  VTK_PY_GIL_RELEASE
+   return ret_value;
+ }
+ 
+@@ -190,12 +196,14 @@
+ 
+   this->Internals->GetInteractiveConsole(); //ensure the console is initialized
+ 
++  VTK_PY_GIL_ENSURE
+   PyObject* context = this->Internals->GetInteractiveConsoleLocalsPyObject();
+   PyObject* result = PyRun_String(const_cast(script), Py_file_input, context, context);
+ 
+   if (result == NULL)
+     {
+     PyErr_Print();
++    VTK_PY_GIL_RELEASE
+     return -1;
+     }
+ 
+@@ -204,6 +212,7 @@
+     {
+     PyErr_Clear();
+     }
++  VTK_PY_GIL_RELEASE
+   return 0;
+ }
+ 
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx
+--- ParaView-4.2.0_SRC/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx	2014-09-23 18:47:11.000000000 +0400
++++ ParaView-4.2.0_SRC.new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx	2014-11-18 15:23:10.000000000 +0300
+@@ -60,10 +60,12 @@
+ 
+   inline void vtkPrependPythonPath(const char* pathtoadd)
+     {
++    VTK_PY_GIL_ENSURE
+     PyObject* path = PySys_GetObject(const_cast("path"));
+     PyObject* newpath = PyString_FromString(pathtoadd);
+     PyList_Insert(path, 0, newpath);
+     Py_DECREF(newpath);
++    VTK_PY_GIL_RELEASE
+     }
+ }
+ 
+@@ -107,7 +109,6 @@
+ //----------------------------------------------------------------------------
+ bool vtkPythonInterpreter::Initialize(int initsigs /*=0*/)
+ {
+-  vtkPythonInterpreter::InitializedOnce = true;
+   if (Py_IsInitialized() == 0)
+     {
+ #if (VTK_PYTHON_MAJOR_VERSION > 2) ||\
+@@ -117,11 +118,26 @@
+     (void)initsigs;
+     Py_Initialize();
+ #endif
+-
+ #ifdef SIGINT
+     // Put default SIGINT handler back after Py_Initialize/Py_InitializeEx.
+     signal(SIGINT, SIG_DFL);
+ #endif
++    }
++
++  if (! vtkPythonInterpreter::InitializedOnce)
++    {
++#ifndef VTK_NO_PYTHON_THREADS
++    int threadInit = PyEval_ThreadsInitialized();
++    PyEval_InitThreads(); // safe to call this multiple time
++#endif
++    // At this point we have GIL, or we are mono-thread.
++    // Access to the static below is safe:
++    vtkPythonInterpreter::InitializedOnce = true;
++
++#ifndef VTK_NO_PYTHON_THREADS
++    if(!threadInit)
++      PyEval_SaveThread(); // release GIL
++#endif
+     // HACK: Calling PyRun_SimpleString for the first time for some reason results in
+     // a "\n" message being generated which is causing the error dialog to
+     // popup. So we flush that message out of the system before setting up the
+@@ -134,15 +150,17 @@
+     vtkPythonStdStreamCaptureHelper* wrapperErr =
+       NewPythonStdStreamCaptureHelper(true);
+ 
+-    // Redirect Python's stdout and stderr and stdin
+-    PySys_SetObject(const_cast("stdout"),
++    // Redirect Python's stdout and stderr and stdin - GIL protected operation
++    VTK_PY_GIL_ENSURE
++    int ret1 = PySys_SetObject(const_cast("stdout"),
+       reinterpret_cast(wrapperOut));
+-    PySys_SetObject(const_cast("stderr"),
++    int ret2 = PySys_SetObject(const_cast("stderr"),
+       reinterpret_cast(wrapperErr));
+-    PySys_SetObject(const_cast("stdin"),
++    int ret3 = PySys_SetObject(const_cast("stdin"),
+       reinterpret_cast(wrapperOut));
+     Py_DECREF(wrapperOut);
+     Py_DECREF(wrapperErr);
++    VTK_PY_GIL_RELEASE
+ 
+     for (size_t cc=0; cc < PythonPaths.size(); cc++)
+       {
+@@ -162,6 +180,7 @@
+   if (Py_IsInitialized() != 0)
+     {
+     NotifyInterpreters(vtkCommand::ExitEvent);
++    VTK_PY_GIL_ENSURE
+     Py_Finalize();
+     }
+ }
+@@ -213,6 +232,7 @@
+ }
+ 
+ //----------------------------------------------------------------------------
++// [ABN] not thread safe for now - only used by pvpython?
+ int vtkPythonInterpreter::PyMain(int argc, char** argv)
+ {
+   if (!vtkPythonInterpreter::InitializedOnce && Py_IsInitialized() == 0 &&
+@@ -235,7 +255,9 @@
+   buffer.erase(std::remove(buffer.begin(), buffer.end(), '\r'), buffer.end());
+ 
+   // The cast is necessary because PyRun_SimpleString() hasn't always been const-correct
++  VTK_PY_GIL_ENSURE
+   PyRun_SimpleString(const_cast(buffer.c_str()));
++  VTK_PY_GIL_RELEASE
+ }
+ 
+ //----------------------------------------------------------------------------
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx
+--- ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx	2014-09-23 18:47:11.000000000 +0400
++++ ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx	2014-11-18 15:23:10.000000000 +0300
+@@ -30,14 +30,18 @@
+   vtkPythonUtil::UnRegisterPythonCommand(this);
+   if (this->obj && Py_IsInitialized())
+     {
++    VTK_PY_GIL_ENSURE
+     Py_DECREF(this->obj);
++    VTK_PY_GIL_RELEASE
+     }
+   this->obj = NULL;
+ }
+ 
+ void vtkPythonCommand::SetObject(PyObject *o)
+ {
++  VTK_PY_GIL_ENSURE
+   Py_INCREF(o);
++  VTK_PY_GIL_RELEASE
+   this->obj = o;
+ }
+ 
+@@ -92,11 +96,11 @@
+   // If a threadstate has been set using vtkPythonCommand::SetThreadState,
+   // then swap it in here.  See the email to vtk-developers@vtk.org from
+   // June 18, 2009 with subject "Py_NewInterpreter and vtkPythonCallback issue"
+-  PyThreadState* prevThreadState = NULL;
+-  if (this->ThreadState)
+-    {
+-    prevThreadState = PyThreadState_Swap(this->ThreadState);
+-    }
++//  PyThreadState* prevThreadState = NULL;
++//  if (this->ThreadState)
++//    {
++//    prevThreadState = PyThreadState_Swap(this->ThreadState);
++//    }
+ 
+   PyObject * obj2 = NULL;
+   if (ptr && ptr->GetReferenceCount() > 0)
+@@ -237,10 +241,10 @@
+     }
+ 
+   // If we did the swap near the top of this function then swap back now.
+-  if (this->ThreadState)
+-    {
+-    PyThreadState_Swap(prevThreadState);
+-    }
++//  if (this->ThreadState)
++//    {
++//    PyThreadState_Swap(prevThreadState);
++//    }
+ 
+ #ifndef VTK_NO_PYTHON_THREADS
+ #if (PY_MAJOR_VERSION > 2) || \
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx
+--- ParaView-4.2.0_SRC/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx	2014-09-23 18:47:11.000000000 +0400
++++ ParaView-4.2.0_SRC.new/VTK/Wrapping/PythonCore/vtkSmartPyObject.cxx	2014-11-18 15:23:10.000000000 +0300
+@@ -30,37 +30,52 @@
+ vtkSmartPyObject::vtkSmartPyObject(const vtkSmartPyObject &other) :
+   Object(other.Object)
+ {
++  VTK_PY_GIL_ENSURE
+   Py_XINCREF(this->Object);
++  VTK_PY_GIL_RELEASE
+ }
+ 
+ //--------------------------------------------------------------------
+ vtkSmartPyObject::~vtkSmartPyObject()
+ {
+-  Py_XDECREF(this->Object);
++  if (Py_IsInitialized())
++    {
++    VTK_PY_GIL_ENSURE
++    Py_XDECREF(this->Object);
++    VTK_PY_GIL_RELEASE
++    }
++  else
++    Py_XDECREF(this->Object);
+ }
+ 
+ //--------------------------------------------------------------------
+ vtkSmartPyObject &vtkSmartPyObject::operator=(const vtkSmartPyObject &other)
+ {
++  VTK_PY_GIL_ENSURE
+   Py_XDECREF(this->Object);
+   this->Object = other.Object;
+   Py_XINCREF(this->Object);
++  VTK_PY_GIL_RELEASE
+   return *this;
+ }
+ 
+ //--------------------------------------------------------------------
+ vtkSmartPyObject &vtkSmartPyObject::operator=(PyObject *obj)
+ {
++  VTK_PY_GIL_ENSURE
+   Py_XDECREF(this->Object);
+   this->Object = obj;
+   Py_XINCREF(this->Object);
++  VTK_PY_GIL_RELEASE
+   return *this;
+ }
+ 
+ //--------------------------------------------------------------------
+ void vtkSmartPyObject::TakeReference(PyObject *obj)
+ {
++  VTK_PY_GIL_ENSURE
+   Py_XDECREF(this->Object);
++  VTK_PY_GIL_RELEASE
+   this->Object = obj;
+ }
+ 
+@@ -99,6 +114,8 @@
+ //--------------------------------------------------------------------
+ PyObject *vtkSmartPyObject::GetAndIncreaseReferenceCount()
+ {
++  VTK_PY_GIL_ENSURE
+   Py_XINCREF(this->Object);
++  VTK_PY_GIL_RELEASE
+   return this->Object;
+ }
+diff -Naur --exclude=CVS --exclude=.git ParaView-4.2.0_SRC/Wrapping/Python/paraview/servermanager.py ParaView-4.2.0_SRC.new/Wrapping/Python/paraview/servermanager.py
+--- ParaView-4.2.0_SRC/Wrapping/Python/paraview/servermanager.py	2014-09-23 18:46:44.000000000 +0400
++++ ParaView-4.2.0_SRC.new/Wrapping/Python/paraview/servermanager.py	2014-11-18 15:23:10.000000000 +0300
+@@ -1092,7 +1092,7 @@
+         property = self.SMProperty
+         nElems = property.GetNumberOfElements()
+         if nElems%2 != 0:
+-            raise ValueError, "The SMProperty with XML label '%s' has a size that is not a multiple of 2." % property.GetXMLLabel()
++            nElems -= 1
+         self.__arrays = []
+         for i in range(0, nElems, 2):
+             if self.GetElement(i+1) != '0':
-- 
2.39.2