Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
af976b2d
Commit
af976b2d
authored
Nov 28, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatic unregistration of tool actions during ACTION_MANAGER destruction.
parent
c21ae6ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
action_manager.cpp
common/tool/action_manager.cpp
+7
-0
action_manager.h
include/tool/action_manager.h
+6
-0
pcb_tools.cpp
pcbnew/tools/pcb_tools.cpp
+1
-6
No files found.
common/tool/action_manager.cpp
View file @
af976b2d
...
@@ -34,6 +34,13 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
...
@@ -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
)
void
ACTION_MANAGER
::
RegisterAction
(
TOOL_ACTION
*
aAction
)
{
{
assert
(
aAction
->
GetId
()
==
-
1
);
// Check if the TOOL_ACTION was not registered before
assert
(
aAction
->
GetId
()
==
-
1
);
// Check if the TOOL_ACTION was not registered before
...
...
include/tool/action_manager.h
View file @
af976b2d
...
@@ -47,6 +47,12 @@ public:
...
@@ -47,6 +47,12 @@ public:
*/
*/
ACTION_MANAGER
(
TOOL_MANAGER
*
aToolManager
);
ACTION_MANAGER
(
TOOL_MANAGER
*
aToolManager
);
/**
* Destructor.
* Unregisters every registered action.
*/
~
ACTION_MANAGER
();
/**
/**
* Function RegisterAction()
* Function RegisterAction()
* Adds a tool action to the manager and sets it up. After that is is possible to invoke
* Adds a tool action to the manager and sets it up. After that is is possible to invoke
...
...
pcbnew/tools/pcb_tools.cpp
View file @
af976b2d
...
@@ -61,13 +61,8 @@ void PCB_EDIT_FRAME::setupTools()
...
@@ -61,13 +61,8 @@ void PCB_EDIT_FRAME::setupTools()
void
PCB_EDIT_FRAME
::
destroyTools
()
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_toolManager
;
delete
m_toolDispatcher
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment