summaryrefslogtreecommitdiff
diff options
-rw-r--r--panel/PanelController.cpp2
-rw-r--r--unity-shared/GnomeKeyGrabber.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/panel/PanelController.cpp b/panel/PanelController.cpp
index e4edb8115..c1da5d0d9 100644
--- a/panel/PanelController.cpp
+++ b/panel/PanelController.cpp
@@ -159,7 +159,7 @@ void Controller::Impl::GrabEntryMnemonics(indicator::Entry::Ptr const& entry)
{
gunichar mnemonic;
- if (pango_parse_markup(entry->label().c_str(), -1, '_', NULL, NULL, &mnemonic, NULL) && mnemonic)
+ if (pango_parse_markup(entry->label().c_str(), -1, '_', nullptr, nullptr, &mnemonic, nullptr) && mnemonic)
{
auto key = gdk_keyval_to_lower(gdk_unicode_to_keyval(mnemonic));
glib::String accelerator(gtk_accelerator_name(key, GDK_MOD1_MASK));
diff --git a/unity-shared/GnomeKeyGrabber.cpp b/unity-shared/GnomeKeyGrabber.cpp
index 2de3a8b84..4333b3d06 100644
--- a/unity-shared/GnomeKeyGrabber.cpp
+++ b/unity-shared/GnomeKeyGrabber.cpp
@@ -73,8 +73,11 @@ GnomeKeyGrabber::Impl::Impl(CompScreen* screen, bool test_mode)
GnomeKeyGrabber::Impl::~Impl()
{
- for (auto& action : actions_)
- screen_->removeAction(&action);
+ if (screen_)
+ {
+ for (auto& action : actions_)
+ screen_->removeAction(&action);
+ }
}
unsigned int GnomeKeyGrabber::Impl::addAction(CompAction const& action, bool addressable)
@@ -89,7 +92,8 @@ unsigned int GnomeKeyGrabber::Impl::addAction(CompAction const& action, bool add
actions_by_action_id_[current_action_id_] = &action;
}
- screen_->addAction(&actions_.back());
+ if (screen_)
+ screen_->addAction(&actions_.back());
return current_action_id_;
}
@@ -109,7 +113,8 @@ bool GnomeKeyGrabber::Impl::removeAction(unsigned int action_id)
auto j = actions_.begin() + (i - action_ids_.begin());
auto k = actions_by_action_id_.find(action_id);
- screen_->removeAction(&(*j));
+ if (screen_)
+ screen_->removeAction(&(*j));
if (k != actions_by_action_id_.end())
{