Author: rgheck
Date: Mon Nov  1 20:37:59 2010
New Revision: 35970
URL: http://www.lyx.org/trac/changeset/35970

Log:
Fix bug #7002. I think this is correct, but Peter should check.
May I, may I ?

                func_ = f;
-               callInGuiThread();
+               if (theApp() == 0)
+                       synchronousFunctionCall();
+               else
+                       callInGuiThread();
        }

Why not doing this check in callInGuiThread(). There already is made a decision whether to call it in a new thread or not:

void IntoGuiThreadMover::callInGuiThread()
{
    QThread* gui_thread = QApplication::instance()->thread();
    if (QThread::currentThread() == gui_thread) {
        // do synchronous thing
    else
        // do threaded thing
}

Isn't it as simple to change this to something like:

QApplication * app = QApplication::instance();
if (!app || QThread()::currentThread() = app->thread())
        // do synchronous thing
else
        // do threaded thing

Vincent

Reply via email to