mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
Ref T739, avoid issues with binding during shutdown
This commit is contained in:
committed by
Mat Sutcliffe
parent
cfead08b13
commit
027dc50b69
@@ -18,6 +18,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
QString CActionBind::registerAction(const QString &action, const QPixmap &icon)
|
QString CActionBind::registerAction(const QString &action, const QPixmap &icon)
|
||||||
{
|
{
|
||||||
|
if (!sApp || sApp->isShuttingDown()) return {};
|
||||||
|
|
||||||
const QString a = CActionBind::normalizeAction(action);
|
const QString a = CActionBind::normalizeAction(action);
|
||||||
Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager");
|
Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager");
|
||||||
sApp->getInputManager()->registerAction(a, icon);
|
sApp->getInputManager()->registerAction(a, icon);
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace BlackCore
|
|||||||
QObject *parent = nullptr) :
|
QObject *parent = nullptr) :
|
||||||
QObject(parent), m_deleteCallback(deleteCallback)
|
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);
|
const QString a = CActionBind::registerAction(action, icon);
|
||||||
Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager");
|
Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager");
|
||||||
m_index = sApp->getInputManager()->bind(a, receiver, slot);
|
m_index = sApp->getInputManager()->bind(a, receiver, slot);
|
||||||
|
|||||||
Reference in New Issue
Block a user