wxCHECK_MSG( command, FALSE, _T("no command in wxCommandProcessor::Submit") );
if ( !DoCommand(*command) )
+ {
+ // the user code expects the command to be deleted anyhow
+ delete command;
+
return FALSE;
+ }
if ( storeIt )
Store(command);
{
wxCommand *redoCommand = (wxCommand *) NULL;
wxNode *redoNode = (wxNode *) NULL;
- if (m_currentCommand && m_currentCommand->Next())
+
+ if ( m_currentCommand )
{
- redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
- redoNode = m_currentCommand->Next();
+ // is there anything to redo?
+ if ( m_currentCommand->Next() )
+ {
+ redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
+ redoNode = m_currentCommand->Next();
+ }
}
- else
+ else // no current command, redo the first one
{
if (m_commands.Number() > 0)
{