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,9 +670,9 @@ void Application::deleteTrayIcon() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::showGuiMessage(Notification::Event event,
|
||||
void Application::showGuiMessageCore(Notification::Event event,
|
||||
const GuiMessage& msg,
|
||||
const GuiMessageDestination& dest,
|
||||
GuiMessageDestination dest,
|
||||
const GuiAction& action,
|
||||
QWidget* parent) {
|
||||
if (SystemTrayIcon::areNotificationsEnabled()) {
|
||||
|
@ -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() {
|
||||
#if !defined(USE_WEBENGINE)
|
||||
return new TextBrowserViewer();
|
||||
|
|
|
@ -163,7 +163,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
// or in message box if tray icon is disabled.
|
||||
void showGuiMessage(Notification::Event event,
|
||||
const GuiMessage& msg,
|
||||
const GuiMessageDestination& dest = {},
|
||||
GuiMessageDestination dest = {},
|
||||
const GuiAction& action = {},
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
|
@ -193,6 +193,12 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
|
||||
void displayLog();
|
||||
|
||||
void showGuiMessageCore(Notification::Event event,
|
||||
const GuiMessage& msg,
|
||||
GuiMessageDestination dest = {},
|
||||
const GuiAction& action = {},
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void fillCmdArgumentsParser(QCommandLineParser& parser);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue