use invoking when displaying messageboxes to avoid crashes when called directly from non-gui thread
This commit is contained in:
parent
8ecff5763b
commit
48ed8497ea
2 changed files with 27 additions and 6 deletions
|
@ -670,11 +670,11 @@ void Application::deleteTrayIcon() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::showGuiMessage(Notification::Event event,
|
void Application::showGuiMessageCore(Notification::Event event,
|
||||||
const GuiMessage& msg,
|
const GuiMessage& msg,
|
||||||
const GuiMessageDestination& dest,
|
GuiMessageDestination dest,
|
||||||
const GuiAction& action,
|
const GuiAction& action,
|
||||||
QWidget* parent) {
|
QWidget* parent) {
|
||||||
if (SystemTrayIcon::areNotificationsEnabled()) {
|
if (SystemTrayIcon::areNotificationsEnabled()) {
|
||||||
auto notification = m_notifications->notificationForEvent(event);
|
auto notification = m_notifications->notificationForEvent(event);
|
||||||
|
|
||||||
|
@ -714,6 +714,21 @@ void Application::showGuiMessage(Notification::Event event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::showGuiMessage(Notification::Event event,
|
||||||
|
const GuiMessage& msg,
|
||||||
|
GuiMessageDestination dest,
|
||||||
|
const GuiAction& action,
|
||||||
|
QWidget* parent) {
|
||||||
|
QMetaObject::invokeMethod(this,
|
||||||
|
"showGuiMessageCore",
|
||||||
|
Qt::ConnectionType::QueuedConnection,
|
||||||
|
Q_ARG(Notification::Event, event),
|
||||||
|
Q_ARG(const GuiMessage&, msg),
|
||||||
|
Q_ARG(GuiMessageDestination, dest),
|
||||||
|
Q_ARG(const GuiAction&, action),
|
||||||
|
Q_ARG(QWidget*, parent));
|
||||||
|
}
|
||||||
|
|
||||||
WebViewer* Application::createWebView() {
|
WebViewer* Application::createWebView() {
|
||||||
#if !defined(USE_WEBENGINE)
|
#if !defined(USE_WEBENGINE)
|
||||||
return new TextBrowserViewer();
|
return new TextBrowserViewer();
|
||||||
|
|
|
@ -163,7 +163,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||||
// or in message box if tray icon is disabled.
|
// or in message box if tray icon is disabled.
|
||||||
void showGuiMessage(Notification::Event event,
|
void showGuiMessage(Notification::Event event,
|
||||||
const GuiMessage& msg,
|
const GuiMessage& msg,
|
||||||
const GuiMessageDestination& dest = {},
|
GuiMessageDestination dest = {},
|
||||||
const GuiAction& action = {},
|
const GuiAction& action = {},
|
||||||
QWidget* parent = nullptr);
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
@ -193,6 +193,12 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||||
|
|
||||||
void displayLog();
|
void displayLog();
|
||||||
|
|
||||||
|
void showGuiMessageCore(Notification::Event event,
|
||||||
|
const GuiMessage& msg,
|
||||||
|
GuiMessageDestination dest = {},
|
||||||
|
const GuiAction& action = {},
|
||||||
|
QWidget* parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue