diff --git a/cmd/xfe/src/Command.cpp b/cmd/xfe/src/Command.cpp index 6af18f720d2..500c6579db2 100644 --- a/cmd/xfe/src/Command.cpp +++ b/cmd/xfe/src/Command.cpp @@ -439,6 +439,16 @@ XFE_CommandList::XFE_CommandList(XFE_CommandList* list, XFE_Command* command) m_command = command; } +XFE_CommandList::~XFE_CommandList() +{ + m_next = 0; + + if (m_command) { + delete m_command; + m_command = 0; + } +} + XFE_CommandList* registerCommand(XFE_CommandList*& list, XFE_Command* command) { @@ -457,6 +467,18 @@ findCommand(XFE_CommandList* list, CommandType id) return NULL; } +void +destroyCommandList(XFE_CommandList* list) +{ + XFE_CommandList *next; + + while (list != NULL) { + next = list->m_next; + delete list; + list = next; + } +} + XFE_ObjectIsCommand::XFE_ObjectIsCommand(XFE_View *view) : XFE_ViewCommand(xfeCmdObjectIs, view) { }; diff --git a/cmd/xfe/src/Command.h b/cmd/xfe/src/Command.h index a73a7db51b2..e08905cbac1 100644 --- a/cmd/xfe/src/Command.h +++ b/cmd/xfe/src/Command.h @@ -222,8 +222,10 @@ class XFE_CommandList { public: friend XFE_Command* findCommand(XFE_CommandList*, CommandType); friend XFE_CommandList* registerCommand(XFE_CommandList*&, XFE_Command*); + friend void destroyCommandList(XFE_CommandList*); private: XFE_CommandList(XFE_CommandList*, XFE_Command*); + ~XFE_CommandList(); XFE_CommandList* m_next; XFE_Command* m_command; }; diff --git a/cmd/xfe/src/EditorView.cpp b/cmd/xfe/src/EditorView.cpp index e536d7a627e..2164987d240 100644 --- a/cmd/xfe/src/EditorView.cpp +++ b/cmd/xfe/src/EditorView.cpp @@ -36,10 +36,6 @@ #include "pk11func.h" #endif -/* BIG HACK HERE. REMOVE MUCH SOON. needs to be fixed in -ns/modules/security/nav/rosetta.h*/ -#define my_commands m_commands - extern "C" int XFE_EDITOR_NEWTABLE_COLS; #define FE_SYNTAX_ERROR() doSyntaxErrorAlert(view, info) @@ -3058,6 +3054,10 @@ XFE_EditorView::~XFE_EditorView() XtRemoveTimeOut(m_update_timer); m_update_timer = 0; } + if (m_commands) { + destroyCommandList(m_commands); + m_commands = 0; + } } char*