Fix crash at study closing. Enable canceling Prism 3D computation

This commit is contained in:
eap 2014-07-22 18:57:36 +04:00
parent a3ee66b037
commit f3ce9fcd40
2 changed files with 13 additions and 2 deletions

View File

@ -74,12 +74,20 @@ public:
void DeleteAll() void DeleteAll()
{ {
for ( size_t i = 0; i < myVec.size(); ++i ) for ( size_t i = 0; i < myVec.size(); ++i )
delete myVec[i]; if ( SUBMESH* sm = myVec[i] )
{
myVec[i] = 0; // avoid access via Get(i)
delete sm;
}
myVec.clear(); myVec.clear();
typename std::map< int, SUBMESH* >::iterator i2sm = myMap.begin(); typename std::map< int, SUBMESH* >::iterator i2sm = myMap.begin();
for ( ; i2sm != myMap.end(); ++i2sm ) for ( ; i2sm != myMap.end(); ++i2sm )
delete i2sm->second; if ( SUBMESH* sm = i2sm->second )
{
i2sm->second = 0; // avoid access via Get(i)
delete sm;
}
myMap.clear(); myMap.clear();
} }
int GetMinID() const int GetMinID() const

View File

@ -1203,6 +1203,9 @@ bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
// create a node // create a node
node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() ); node = meshDS->AddNode( coords.X(), coords.Y(), coords.Z() );
meshDS->SetNodeInVolume( node, volumeID ); meshDS->SetNodeInVolume( node, volumeID );
if ( _computeCanceled )
return false;
} }
} // loop on bottom nodes } // loop on bottom nodes
} }