On Sun, Aug 27, 2006 at 10:41:54PM +0200, Abdelrazak Younes wrote:
> 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.
On cygwin it is the other way around, i.e., it is the static instantiation
that causes the crash. OTOH I have never seen the message about the timers,
even if qeventdispatcher_win.cpp is one of the three Windows specific files
that I have to use in the cygwin port of the QtCore library.
--
Enrico