Dont install event filter unless its registered

This commit is contained in:
Jonas Kvinge
2019-04-19 12:36:54 +02:00
parent 844c4a28f4
commit cf92852bb3
2 changed files with 12 additions and 3 deletions

View File

@@ -62,6 +62,7 @@ GlobalShortcut::GlobalShortcut(QKeySequence shortcut, GlobalShortcutBackend *bac
}
GlobalShortcut::~GlobalShortcut() {
if (this == initialized_) {
QAbstractEventDispatcher::instance()->removeNativeEventFilter(this);
initialized_ = nullptr;
@@ -69,6 +70,7 @@ GlobalShortcut::~GlobalShortcut() {
else {
unsetShortcut();
}
}
bool GlobalShortcut::setShortcut(const QKeySequence &shortcut) {