summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r--desktop-widgets/mainwindow.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 95495b663..bcd8f8e6e 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -88,12 +88,22 @@ MainWindow *MainWindow::m_Instance = NULL;
extern "C" void showErrorFromC()
{
+ // Show errors only if we are running in the GUI thread.
+ // If we're not in the GUI thread, let errors accumulate.
+ if (QThread::currentThread() != QCoreApplication::instance()->thread())
+ return;
+
MainWindow *mainwindow = MainWindow::instance();
- if (mainwindow) {
- mainwindow->getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
- }
+ if (mainwindow)
+ mainwindow->showErrors();
}
+void MainWindow::showErrors()
+{
+ const char *error = get_error_string();
+ if (error && error[0])
+ getNotificationWidget()->showNotification(error, KMessageWidget::Error);
+}
MainWindow::MainWindow() : QMainWindow(),
actionNextDive(0),