void CMLink::DeleteOneShotCommands ( JPtrArray<CMCommand>* list ) { const JSize count = list->GetElementCount(); for (JIndex i=count; i>=1; i--) { CMCommand* cmd = list->NthElement(i); if (cmd->IsOneShot()) { delete cmd; // automatically removed from list } } }