+            wxList::compatibility_iterator next = node->GetNext();
+            delete (wxCommand *)node->GetData();
+            m_commands.Erase(node);
+
+            // Make sure m_lastSavedCommand won't point to freed memory
+            if ( m_lastSavedCommand == node )
+                m_lastSavedCommand = wxList::compatibility_iterator();
+