]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/InGuiThread.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / InGuiThread.cpp
index ff53f9d0e9619be2564ea3b2f890b314e44df351..20be94cffe22caf766cc29915fc4f92fdc42b9fe 100644 (file)
@@ -12,6 +12,8 @@
 
 #include "InGuiThread.h"
 
+#include "frontends/Application.h"
+
 #include <QThread>
 #include <QEventLoop>
 #include <QApplication>
@@ -29,11 +31,11 @@ IntoGuiThreadMover::IntoGuiThreadMover()
 
 void IntoGuiThreadMover::callInGuiThread()
 {
-       QThread* gui_thread = QApplication::instance()->thread();
-       if (QThread::currentThread() == gui_thread) {
+       if (!theApp() || !QApplication::instance() ||
+               QThread::currentThread() == QApplication::instance()->thread()) {
                synchronousFunctionCall();
        } else {
-               moveToThread(gui_thread);
+               moveToThread(QApplication::instance()->thread());
                connect(this, SIGNAL(triggerFunctionCall()), 
                        this, SLOT(doFunctionCall()), Qt::QueuedConnection);
                QMutexLocker lock(&sync_mutex_);