mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 15:17:27 +05:00
IPAL8739. Fix ReleaseID() for the case ID == myMaxID && myPoolOfID.empty()
This commit is contained in:
parent
f5fcc431a4
commit
914e5a2f63
@ -57,16 +57,27 @@ int SMDS_MeshIDFactory::GetFreeID()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
void SMDS_MeshIDFactory::ReleaseID(const int ID)
|
||||||
{
|
{
|
||||||
if (ID > 0 && ID < myMaxID) myPoolOfID./*push*/insert(ID);
|
if ( ID > 0 )
|
||||||
if (ID > 0 && ID == myMaxID ) {
|
{
|
||||||
set<int>::iterator i = --myPoolOfID.end();
|
if ( ID < myMaxID )
|
||||||
while ( i != myPoolOfID.begin() )
|
{
|
||||||
if ( --myMaxID != *(--i) )
|
myPoolOfID.insert(ID);
|
||||||
break;
|
}
|
||||||
if ( myMaxID == *i )
|
else if ( ID == myMaxID )
|
||||||
--myMaxID; // begin of myPoolOfID reached
|
{
|
||||||
else
|
--myMaxID;
|
||||||
++i;
|
if ( !myPoolOfID.empty() ) // assure that myMaxID is not in myPoolOfID
|
||||||
myPoolOfID.erase( i, myPoolOfID.end() );
|
{
|
||||||
|
set<int>::iterator i = --myPoolOfID.end();
|
||||||
|
while ( i != myPoolOfID.begin() && myMaxID == *i ) {
|
||||||
|
--myMaxID; --i;
|
||||||
|
}
|
||||||
|
if ( myMaxID == *i )
|
||||||
|
--myMaxID; // begin of myPoolOfID reached
|
||||||
|
else
|
||||||
|
++i;
|
||||||
|
myPoolOfID.erase( i, myPoolOfID.end() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user