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);