From 841b33bd05d384c0f3a642ee2ad2c78bf98e876c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 30 Oct 2015 10:26:16 +0100 Subject: shortcuts: fix crash on Linux --- opentrack/shortcuts.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'opentrack/shortcuts.cpp') 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(); - else { - key->setShortcut(QKeySequence::UnknownKey); + using sh = QxtGlobalShortcut; + if (key) + { key->setEnabled(false); - std::shared_ptr ptr = K(); - key.swap(ptr); + key->setShortcut(QKeySequence::UnknownKey); + std::shared_ptr tmp(nullptr); + key.swap(tmp); } + key = std::make_shared(); + if (k.keycode != "") { key->setShortcut(QKeySequence::fromString(k.keycode, QKeySequence::PortableText)); -- cgit v1.2.3