Salome HOME
Fix SIGSEGV at SALOME termination after performing SALOME_TESTS/Grids/smesh/imps_05/F0
authoreap <eap@opencascade.com>
Wed, 29 Mar 2017 11:05:00 +0000 (14:05 +0300)
committereap <eap@opencascade.com>
Wed, 29 Mar 2017 11:05:00 +0000 (14:05 +0300)
doc/salome/gui/SMESH/input/skew.doc
resources/CMakeLists.txt
resources/mesh_hide.png [new file with mode: 0644]
resources/mesh_show.png [new file with mode: 0644]
src/SMESH/SMESH_Gen.cxx
src/SMESH/SMESH_Hypothesis.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESH_images.ts
src/SMESHUtils/SMESH_TypeDefs.hxx

index 036c70d83aaf7e9a655c1f646e0c97286e16cd28..01f3c5feaf6f530ce4fe54955736c57585e24de3 100644 (file)
@@ -3,8 +3,8 @@
 \page skew_page Skew
 
 \n \b Skew mesh quality criterion reflects the angle between the lines
-that join opposite sides of a quadrangle element or the greatesr angle
-between three medians in triangle elements. This mesh quality
+that join opposite sides of a quadrangle element or the greatest angle
+between a median and a midline in a triangle element. This mesh quality
 criterion can be applied to elements composed of 4 and 3 nodes
 (quadrangles and triangles).
 
index da52e07836d4198b4fabc59d36fcea51f54c1780..d2801c905efd76ec6449a9fe71667736a261fc43 100755 (executable)
@@ -226,6 +226,8 @@ SET(SMESH_RESOURCES_FILES
   mesh_extmeth_surf_offset_smooth.png
   mesh_extmeth_face_offset.png
   mesh_quality.png
+  mesh_show.png
+  mesh_hide.png
 )
 
 INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})
diff --git a/resources/mesh_hide.png b/resources/mesh_hide.png
new file mode 100644 (file)
index 0000000..31c505d
Binary files /dev/null and b/resources/mesh_hide.png differ
diff --git a/resources/mesh_show.png b/resources/mesh_show.png
new file mode 100644 (file)
index 0000000..61ebe47
Binary files /dev/null and b/resources/mesh_show.png differ
index f9a89fed733342110e7d2e8145af34ae4e84eeac..bd5654c89588eb1bd05ddde3ae963e978e7cd8eb 100644 (file)
@@ -73,6 +73,19 @@ SMESH_Gen::SMESH_Gen()
   //vtkDebugLeaks::SetExitError(0);
 }
 
+namespace
+{
+  // a structure used to nullify SMESH_Gen field of SMESH_Hypothesis,
+  // which is needed for SMESH_Hypothesis not deleted before ~SMESH_Gen()
+  struct _Hyp : public SMESH_Hypothesis
+  {
+    void NullifyGen()
+    {
+      _gen = 0;
+    }
+  };
+}
+
 //=============================================================================
 /*!
  * Destructor
@@ -84,9 +97,16 @@ SMESH_Gen::~SMESH_Gen()
   std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin();
   for ( ; i_sc != _mapStudyContext.end(); ++i_sc )
   {
-    delete i_sc->second->myDocument;
-    delete i_sc->second;
-  }  
+    StudyContextStruct* context = i_sc->second;
+    std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin();
+    for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp )
+    {
+      if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
+        h->NullifyGen();
+    }
+    delete context->myDocument;
+    delete context;
+  }
 }
 
 //=============================================================================
index 2d1e10c165906c40776ccded4f72a2fcf5e6eb45..c4107fb3892bed30a88f0b640277375422e4640c 100644 (file)
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
 //
-#include "SMESH_Hypothesis.hxx"
 
-#include "SMESHDS_Mesh.hxx"
 #include "SMESH_Gen.hxx"
-#include "SMESH_Mesh.hxx"
-#include "SMESH_subMesh.hxx"
 
-#include "utilities.h"
+#include "SMESHDS_Mesh.hxx"
+#include "SMESH_Hypothesis.hxx"
+#include "SMESH_Mesh.hxx"
 
 using namespace std;
 
 //=============================================================================
 /*!
- * 
+ *
  */
 //=============================================================================
 
@@ -63,8 +61,11 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
 
 SMESH_Hypothesis::~SMESH_Hypothesis()
 {
-  StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
-  myStudyContext->mapHypothesis[_hypId] = 0;
+  if ( _gen )
+  {
+    StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
+    myStudyContext->mapHypothesis[_hypId] = 0;
+  }
 }
 
 //=============================================================================
@@ -77,20 +78,20 @@ int SMESH_Hypothesis::GetDim() const
 {
   int dim = 0;
   switch (_type)
-    {
-    case ALGO_1D: dim = 1; break;
-    case ALGO_2D: dim = 2; break;
-    case ALGO_3D: dim = 3; break;
-    case ALGO_0D: dim = 0; break;
-    case PARAM_ALGO:
-      dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
-    }
+  {
+  case ALGO_1D: dim = 1; break;
+  case ALGO_2D: dim = 2; break;
+  case ALGO_3D: dim = 3; break;
+  case ALGO_0D: dim = 0; break;
+  case PARAM_ALGO:
+    dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
+  }
   return dim;
 }
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
index 0f08808d0b766c228c18f766da8f73620e4d7964..526b6c6500b2b1b0e4a8d2567e86a45669ec2d7e 100644 (file)
@@ -4020,8 +4020,8 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( SMESHOp::OpPropertiesArea,   "MEASURE_AREA",     "ICON_MEASURE_AREA" );
   createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME",   "ICON_MEASURE_VOLUME" );
 
-  createSMESHAction( SMESHOp::OpHide,     "HIDE" );
-  createSMESHAction( SMESHOp::OpShow,     "SHOW" );
+  createSMESHAction( SMESHOp::OpHide,     "HIDE", "ICON_HIDE" );
+  createSMESHAction( SMESHOp::OpShow,     "SHOW", "ICON_SHOW" );
   createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" );
 
   createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
index fde04d78c00dff0795c0639ed7e9bb84c04ea338..9531e409fada3f9ad40e3e40d09df9c7ae7453da 100644 (file)
             <source>ICON_MEASURE_BND_BOX</source>
             <translation>mesh_bounding_box.png</translation>
         </message>
+        <message>
+            <source>ICON_SHOW</source>
+            <translation>mesh_show.png</translation>
+        </message>
+        <message>
+            <source>ICON_HIDE</source>
+            <translation>mesh_hide.png</translation>
+        </message>
     </context>
 </TS>
index 77c095cc17be56cee81a2854fa400945cf35d4be..c9be990f65b274515dd082b134ac98494fa3619a 100644 (file)
@@ -169,6 +169,7 @@ struct SMESH_TNodeXYZ : public gp_XYZ
   double SquareDistance(const SMDS_MeshNode* n) const { return (SMESH_TNodeXYZ( n )-*this).SquareModulus(); }
   bool operator==(const SMESH_TNodeXYZ& other) const { return _node == other._node; }
 };
+typedef SMESH_TNodeXYZ SMESH_NodeXYZ;
 
 //--------------------------------------------------
 /*!