mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-04-04 22:39:10 +00:00
Fix recursive static init (#2196)
* Removed default config for abstract logger that sends a system notification, also cleaned up a useless ifdef * Send notifications from event loop on Win and Mac (#2197) Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> Co-authored-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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<QVariant> args;
|
||||
QVariantMap hintsMap;
|
||||
|
||||
Reference in New Issue
Block a user