]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL16774 (Crash after display of many groups)
authoreap <eap@opencascade.com>
Wed, 7 Nov 2007 10:10:45 +0000 (10:10 +0000)
committereap <eap@opencascade.com>
Wed, 7 Nov 2007 10:10:45 +0000 (10:10 +0000)
    throw if there are errors in buildPrs()

src/OBJECT/SMESH_Object.cxx

index 0dbbc68af10926730bfcc7f6b483210b6a08ac36..748b4ffe48a34a3879ab79afbf6db5da0631a9a8 100644 (file)
@@ -199,10 +199,8 @@ void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
 //=================================================================================
 void SMESH_VisualObjDef::buildPrs()
 {
-  // PAL16631(crash after a mesh computation that failed because of lack of memory):
-  // Catch exceptions upper by stack
-//   try 
-//   {
+  try 
+  {
     mySMDS2VTKNodes.clear();
     myVTK2SMDSNodes.clear();
     mySMDS2VTKElems.clear();
@@ -212,15 +210,20 @@ void SMESH_VisualObjDef::buildPrs()
       buildNodePrs();
     else
       buildElemPrs();
-//   }
-//   catch( const std::exception& exc )
-//   {
-//     INFOS("Follow exception was cought:\n\t"<<exc.what());
-//   }
-//   catch(...)
-//   {
-//     INFOS("Unknown exception was cought !!!");
-//   }
+  }
+  catch(...)
+  {
+    // TODO: catch inside buildNodePrs and buildElemPrs and free
+    // temporarily allocated objects
+    mySMDS2VTKNodes.clear();
+    myVTK2SMDSNodes.clear();
+    mySMDS2VTKElems.clear();
+    myVTK2SMDSElems.clear();
+
+    myGrid->SetPoints( 0 );
+    myGrid->SetCells( 0, 0, 0 );
+    throw;
+  }
   
   if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
   if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );