// pop the operation from the cached map of active operations
QStack<HYDROGUI_Operation*>& anOperations = myModule->getActiveOperations();
- if ( anOperations.top() == this )
- {
- anOperations.pop();
- }
- else {
- // find in the stack the current operation and remove it from the stack
- QVectorIterator<HYDROGUI_Operation*> aVIt( anOperations );
- aVIt.toBack();
- aVIt.previous(); // skip the top show/hide operation
- while ( aVIt.hasPrevious() )
+ if ( !anOperations.empty() ) {
+ if ( anOperations.top() == this )
+ anOperations.pop();
+ else
{
- HYDROGUI_Operation* anOp = aVIt.previous();
- if ( anOp == this )
- anOperations.remove( anOperations.lastIndexOf( anOp ) );
+ // find in the stack the current operation and remove it from the stack
+ QVectorIterator<HYDROGUI_Operation*> aVIt( anOperations );
+ aVIt.toBack();
+ aVIt.previous(); // skip the top show/hide operation
+ while ( aVIt.hasPrevious() )
+ {
+ HYDROGUI_Operation* anOp = aVIt.previous();
+ if ( anOp == this )
+ anOperations.remove( anOperations.lastIndexOf( anOp ) );
+ }
}
}
// release the preview manager with removing the added preview Z layer