diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 8b232c51..08bbd3f5 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -519,12 +519,10 @@ void Controller::enableTrayIcon() void Controller::disableTrayIcon() { -#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) || defined(Q_OS_MACOS) if (m_trayIcon) { m_trayIcon->hide(); } ConfigHandler().setDisabledTrayIcon(true); -#endif } void Controller::sendTrayNotification(const QString& text, diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index d1a5deb0..c4be02b3 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -40,7 +40,14 @@ void SystemNotification::sendMessage(const QString& text, } #if defined(Q_OS_MACOS) || defined(Q_OS_WIN) - Controller::getInstance()->sendTrayNotification(text, title, timeout); + QMetaObject::invokeMethod( + this, + [&]() { + // The call is queued to avoid recursive static initialization of + // Controller and ConfigHandler. + Controller::getInstance()->sendTrayNotification(text, title, timeout); + }, + Qt::QueuedConnection); #else QList args; QVariantMap hintsMap;