From c7116e9d0316704da2a04ebc4ca35aaa91f96efe Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 21 Mar 2014 17:55:46 +0100 Subject: [PATCH] FIxed too late deletion of TOOLs. --- common/tool/tool_manager.cpp | 10 +++++++++- include/tool/tool_manager.h | 5 +++++ pcbnew/tools/pcb_tools.cpp | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 57a98779f6..0d25c88434 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -103,6 +103,14 @@ TOOL_MANAGER::TOOL_MANAGER() : TOOL_MANAGER::~TOOL_MANAGER() +{ + DeleteAll(); + + delete m_actionMgr; +} + + +void TOOL_MANAGER::DeleteAll() { std::map::iterator it, it_end; @@ -113,7 +121,7 @@ TOOL_MANAGER::~TOOL_MANAGER() delete it->first; // delete the tool itself } - delete m_actionMgr; + m_toolState.clear(); } diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index 04afea3483..1103a7f890 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -57,6 +57,11 @@ public: ~TOOL_MANAGER(); + /** + * Deletes all the tools that were registered in the TOOL_MANAGER. + */ + void DeleteAll(); + /** * Generates an unique ID from for a tool with given name. */ diff --git a/pcbnew/tools/pcb_tools.cpp b/pcbnew/tools/pcb_tools.cpp index 28a1b424a3..437ad4fba8 100644 --- a/pcbnew/tools/pcb_tools.cpp +++ b/pcbnew/tools/pcb_tools.cpp @@ -68,6 +68,7 @@ void PCB_EDIT_FRAME::setupTools() void PCB_EDIT_FRAME::destroyTools() { + m_toolManager.DeleteAll(); delete m_toolDispatcher; }