summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorWilliam Hua <william.hua@canonical.com>2014-02-07 16:07:15 +0000
committerWilliam Hua <william.hua@canonical.com>2014-02-07 16:07:15 +0000
commit11d7ef6aaef2800d0412be2758c3520cc6ef9a4b (patch)
treea84efd265c53ac0cee26b75bebe56c7d945bdbb6 /unity-shared
parent2d5b7d76745e8ffa02796f8ccaeecfeb2955cace (diff)
Remove grabbed actions on destruction.
(bzr r3608.4.37)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/GnomeKeyGrabber.cpp6
-rw-r--r--unity-shared/GnomeKeyGrabberImpl.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/unity-shared/GnomeKeyGrabber.cpp b/unity-shared/GnomeKeyGrabber.cpp
index 1469643ce..2de3a8b84 100644
--- a/unity-shared/GnomeKeyGrabber.cpp
+++ b/unity-shared/GnomeKeyGrabber.cpp
@@ -71,6 +71,12 @@ GnomeKeyGrabber::Impl::Impl(CompScreen* screen, bool test_mode)
shell_object_->SetMethodsCallsHandler(sigc::mem_fun(this, &Impl::onShellMethodCall));
}
+GnomeKeyGrabber::Impl::~Impl()
+{
+ for (auto& action : actions_)
+ screen_->removeAction(&action);
+}
+
unsigned int GnomeKeyGrabber::Impl::addAction(CompAction const& action, bool addressable)
{
++current_action_id_;
diff --git a/unity-shared/GnomeKeyGrabberImpl.h b/unity-shared/GnomeKeyGrabberImpl.h
index 2a434a84b..3367ce9b9 100644
--- a/unity-shared/GnomeKeyGrabberImpl.h
+++ b/unity-shared/GnomeKeyGrabberImpl.h
@@ -46,6 +46,7 @@ struct GnomeKeyGrabber::Impl
std::unordered_map<unsigned int, CompAction const*> actions_by_action_id_;
explicit Impl(CompScreen* screen, bool test_mode = false);
+ ~Impl();
unsigned int addAction(CompAction const& action, bool addressable = true);
bool removeAction(CompAction const& action);