{
wxCHECK_RET( command, wxT("no command in wxCommandProcessor::Store") );
- if ( (int)m_commands.GetCount() == m_maxNoCommands )
- {
- wxList::compatibility_iterator firstNode = m_commands.GetFirst();
- wxCommand *firstCommand = (wxCommand *)firstNode->GetData();
- delete firstCommand;
- m_commands.Erase(firstNode);
-
- // Make sure m_lastSavedCommand won't point to freed memory
- if ( m_lastSavedCommand == firstNode )
- m_lastSavedCommand = wxList::compatibility_iterator();
- }
-
// Correct a bug: we must chop off the current 'branch'
// so that we're at the end of the command list.
if (!m_currentCommand)
}
}
+ if ( (int)m_commands.GetCount() == m_maxNoCommands )
+ {
+ wxList::compatibility_iterator firstNode = m_commands.GetFirst();
+ wxCommand *firstCommand = (wxCommand *)firstNode->GetData();
+ delete firstCommand;
+ m_commands.Erase(firstNode);
+
+ // Make sure m_lastSavedCommand won't point to freed memory
+ if ( m_lastSavedCommand == firstNode )
+ m_lastSavedCommand = wxList::compatibility_iterator();
+ }
+
m_commands.Append(command);
m_currentCommand = m_commands.GetLast();
SetMenuStrings();