From 027dc50b69bae32ee953d1119f92509b75aef201 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 5 Oct 2019 00:22:28 +0200 Subject: [PATCH] Ref T739, avoid issues with binding during shutdown --- src/blackcore/actionbind.cpp | 2 ++ src/blackcore/actionbind.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/blackcore/actionbind.cpp b/src/blackcore/actionbind.cpp index db7ade4af..e11f501e4 100644 --- a/src/blackcore/actionbind.cpp +++ b/src/blackcore/actionbind.cpp @@ -18,6 +18,8 @@ namespace BlackCore QString CActionBind::registerAction(const QString &action, const QPixmap &icon) { + if (!sApp || sApp->isShuttingDown()) return {}; + const QString a = CActionBind::normalizeAction(action); Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager"); sApp->getInputManager()->registerAction(a, icon); diff --git a/src/blackcore/actionbind.h b/src/blackcore/actionbind.h index 083ce13ff..3f4a194ce 100644 --- a/src/blackcore/actionbind.h +++ b/src/blackcore/actionbind.h @@ -37,6 +37,9 @@ namespace BlackCore QObject *parent = nullptr) : QObject(parent), m_deleteCallback(deleteCallback) { + // workaround if a binding is taking place in an empty context + if (!sApp || sApp->isShuttingDown()) { return; } + const QString a = CActionBind::registerAction(action, icon); Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager"); m_index = sApp->getInputManager()->bind(a, receiver, slot);