Automatic unregistration of tool actions during ACTION_MANAGER destruction.
This commit is contained in:
parent
c21ae6efca
commit
af976b2d36
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue