Georg Baum wrote:
Am Sonntag, 27. August 2006 06:08 schrieb Enrico Forestieri:
The attached patch avoids the crash when quitting LyX.

--
Enrico
nostatic.diff
  Index: src/frontends/qt4/lyx_gui.C
===================================================================
--- src/frontends/qt4/lyx_gui.C (revision 14845)
+++ src/frontends/qt4/lyx_gui.C (working copy)
@@ -129,7 +129,7 @@ int exec(int & argc, char * argv[])
        // Force adding of font path _before_ QApplication is initialized
        FontLoader::initFontPath();
-#ifdef Q_WS_WIN
+#if defined(Q_WS_WIN) && !defined(Q_CYGWIN_WIN)
        static Application app(argc, argv);
 #else
        Application app(argc, argv);

Why Q_CYGWIN_WIN? Can't you use something predefined? Instead of extending this hack it would be great if somebody could find out what really goes wrong here.

I have investigate quite a bit on that issue. It seems that it is related to multithreading support which is default in Qt4. When quitting, at one point, Qt4 kills all timers for a given thread. The problems is in qeventdispatcher_win.cpp:

bool QEventDispatcherWin32::unregisterTimer(int timerId)
{
    if (timerId < 1) {
qWarning("QEventDispatcherUNIX::unregisterTimer: invalid argument");
        return false;
    }
    QThread *currentThread = QThread::currentThread();
    if (thread() != currentThread) {
qWarning("QObject::killTimer: timers cannot be stopped from another thread");
        return false;
    }

So it seems that Qt thinks that there is more than two threads here... weird as AFAIK there is only one thread in LyX.

When I get some time I plan to clean up the startup procedure so as to avaoid the static hack. I hope the problem will vanish magically after that.

Abdel.




Georg



Reply via email to