summaryrefslogtreecommitdiffhomepage
path: root/opentrack/shortcuts.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-30 10:26:16 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-10-30 10:26:16 +0100
commit841b33bd05d384c0f3a642ee2ad2c78bf98e876c (patch)
tree0f03139c8df659518b38174cb2be5ae0482169b4 /opentrack/shortcuts.cpp
parent3225b24e3ef6ec40bdfa45fdf92714483591a0e9 (diff)
shortcuts: fix crash on Linux
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r--opentrack/shortcuts.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp
index 91d449f1..a33cf088 100644
--- a/opentrack/shortcuts.cpp
+++ b/opentrack/shortcuts.cpp
@@ -115,15 +115,17 @@ void KeybindingWorker::run() {
void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k)
{
#if !defined(_WIN32)
- if (!key)
- key = std::make_shared<QxtGlobalShortcut>();
- else {
- key->setShortcut(QKeySequence::UnknownKey);
+ using sh = QxtGlobalShortcut;
+ if (key)
+ {
key->setEnabled(false);
- std::shared_ptr<QxtGlobalShortcut> ptr = K();
- key.swap(ptr);
+ key->setShortcut(QKeySequence::UnknownKey);
+ std::shared_ptr<sh> tmp(nullptr);
+ key.swap(tmp);
}
+ key = std::make_shared<sh>();
+
if (k.keycode != "")
{
key->setShortcut(QKeySequence::fromString(k.keycode, QKeySequence::PortableText));