Commit af976b2d authored by Maciej Suminski's avatar Maciej Suminski

Automatic unregistration of tool actions during ACTION_MANAGER destruction.

parent c21ae6ef
......@@ -34,6 +34,13 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
}
ACTION_MANAGER::~ACTION_MANAGER()
{
while( !m_actionIdIndex.empty() )
UnregisterAction( m_actionIdIndex.begin()->second );
}
void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
{
assert( aAction->GetId() == -1 ); // Check if the TOOL_ACTION was not registered before
......
......@@ -47,6 +47,12 @@ public:
*/
ACTION_MANAGER( TOOL_MANAGER* aToolManager );
/**
* Destructor.
* Unregisters every registered action.
*/
~ACTION_MANAGER();
/**
* Function RegisterAction()
* Adds a tool action to the manager and sets it up. After that is is possible to invoke
......
......@@ -61,13 +61,8 @@ void PCB_EDIT_FRAME::setupTools()
void PCB_EDIT_FRAME::destroyTools()
{
m_toolManager->UnregisterAction( &COMMON_ACTIONS::moveActivate );
m_toolManager->UnregisterAction( &COMMON_ACTIONS::selectionActivate );
m_toolManager->UnregisterAction( &COMMON_ACTIONS::rotate );
m_toolManager->UnregisterAction( &COMMON_ACTIONS::flip );
delete m_toolDispatcher;
delete m_toolManager;
delete m_toolDispatcher;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment