Salome HOME
Fix crash at switching off faces of shrunk 3D mesh
authoreap <eap@opencascade.com>
Fri, 13 Mar 2020 16:37:51 +0000 (19:37 +0300)
committereap <eap@opencascade.com>
Fri, 13 Mar 2020 16:37:51 +0000 (19:37 +0300)
src/VTKViewer/VTKViewer_ConvexTool.cxx
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index 41a3b3b39402cbb95798c785d1423975345a24d6..3a3d8050b4dacdc2af3575fcf969eced241b9d70 100644 (file)
@@ -107,9 +107,8 @@ VTKViewer_Triangulator
   myPoints->Modified(); // the VTK bug
 
   vtkIdType aNumPts;
-  vtkIdType const *tmp(nullptr);
+  vtkIdType const *tmp(myPointIds);
   theInput->GetCellPoints(theCellId, aNumPts, tmp);
-  std::copy(tmp,tmp+aNumPts,myPointIds);
   if ( aNumPts > 0 ) {
     double anAbsoluteCoord[3];
     myPoints->SetNumberOfPoints(aNumPts);
index 592b743775863dc30547169b5b7eaab5ef941899..6dba69fd7219a082f326808579cf93d5bc703f25 100644 (file)
@@ -28,7 +28,6 @@
 #include "VTKViewer_ConvexTool.h"
 #include "VTKViewer_ArcBuilder.h"
 
-#include <vtkSmartPointer.h>
 #include <vtkCellArray.h>
 #include <vtkCellData.h>
 #include <vtkGenericCell.h>
 #include <vtkPolyData.h>
 #include <vtkPolygon.h>
 #include <vtkPyramid.h>
+#include <vtkSmartPointer.h>
+#include <vtkStaticCellLinks.h>
 #include <vtkStructuredGrid.h>
 #include <vtkTetra.h>
 #include <vtkUnsignedCharArray.h>
 #include <vtkUnstructuredGrid.h>
+#include <vtkVersion.h>
 #include <vtkVoxel.h>
 #include <vtkWedge.h>
-#include <vtkVersion.h>
 
 #include <algorithm>
 #include <iterator>
@@ -118,25 +119,24 @@ VTKViewer_GeometryFilter
 static inline bool toShowEdge( vtkIdType id1, vtkIdType id2, vtkIdType cellId, vtkUnstructuredGrid* input )
 {
   // return true if the given cell is the 1st among cells including the edge
-  vtkCellLinks * links = static_cast<vtkCellLinks *>(input->GetCellLinks());
+  vtkStaticCellLinks * links = static_cast<vtkStaticCellLinks *>(input->GetCellLinks());
   if ( !links ) {
     input->BuildLinks();
-    links = static_cast<vtkCellLinks *>(input->GetCellLinks());
+    links = static_cast<vtkStaticCellLinks *>(input->GetCellLinks());
   }
   if ( id1 < id2 )
     std::swap( id1, id2 );
   vtkIdType *cells = links->GetCells( id1 );
 
   // among cells, look for a cell including the edge
-  vtkIdType *cellPts, npts, iCell = 0;
+  vtkIdType npts, iCell = 0;
+  vtkIdType const *cellPts;
   bool found = false;
   while ( !found )
   {
     if ( cells[iCell] == cellId )
       return true;
-    vtkIdType const *tmp(nullptr);
-    input->GetCellPoints( cells[iCell], npts, tmp );
-    std::copy(tmp, tmp+npts, cellPts);
+    input->GetCellPoints( cells[iCell], npts, cellPts );
     for ( vtkIdType i = 0; i < npts && !found; ++i )
       found = ( cellPts[i] == id2 );
     iCell += ( !found );