list<Handle(_pyCommand)>::reverse_iterator cmd = myUnusedCommands.rbegin();
int distrTypeNb = 0;
for ( ; !distrTypeNb && cmd != myUnusedCommands.rend(); ++cmd )
- if ( (*cmd)->GetMethod() == "SetDistrType" )
- distrTypeNb = (*cmd)->GetOrderNb();
- else if (IsWrapped() && (*cmd)->GetMethod() == "SetObjectEntry" )
+ if ( (*cmd)->GetMethod() == "SetDistrType" ) {
+ if ( cmd != myUnusedCommands.rbegin() )
+ distrTypeNb = (*cmd)->GetOrderNb();
+ }
+ else if (IsWrapped() && (*cmd)->GetMethod() == "SetObjectEntry" ) {
(*cmd)->Clear();
-
+ }
// clear commands before the last SetDistrType()
list<Handle(_pyCommand)> * cmds[2] = { &myArgCommands, &myUnusedCommands };
+ set< int > treatedCmdNbs; // avoid treating same cmd twice
for ( int i = 0; i < 2; ++i ) {
set<TCollection_AsciiString> uniqueMethods;
list<Handle(_pyCommand)> & cmdList = *cmds[i];
for ( cmd = cmdList.rbegin(); cmd != cmdList.rend(); ++cmd )
{
+ if ( !treatedCmdNbs.insert( (*cmd)->GetOrderNb() ).second )
+ continue;// avoid treating same cmd twice
bool clear = ( (*cmd)->GetOrderNb() < distrTypeNb );
const TCollection_AsciiString& method = (*cmd)->GetMethod();
if ( !clear || method == "SetNumberOfSegments" ) {