[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Bug in QEventLoop in Qt3.1beta
From: Lubos Lunak <l.lunak () suse ! cz>
Date: 2002-09-10 17:40:14
[Download RAW message or body]
Hello,
if QApplication::eventLoop() is referenced before QApplication is created
(e.g. when creating a QSocketNotifier, as in kded when fam daemon is running
or dnotify support is enabled), it doesn't add the X11 connection fd to the
list of watched fd's (because there's no QApplication instance at that time).
Later this causes crash when qt_gui_is_used becomes true but d->xfd is still
-1.
The attached patch should fix the problem. You'll also have to do something
with QEventLoop::appStartingUp() in qeventloop.cpp .
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
["qeventloop_x11.cpp.patch" (text/x-diff)]
--- qeventloop_x11.cpp.sav Fri Sep 6 14:31:53 2002
+++ qeventloop_x11.cpp Tue Sep 10 18:24:27 2002
@@ -224,7 +224,7 @@ bool QEventLoop::processNextEvent( Proce
FD_ZERO( &d->sn_vec[2].select_fds );
}
- if ( qt_is_gui_used ) {
+ if ( qt_is_gui_used && d->xfd != -1 ) {
// select for events on the event socket - only on X11
FD_SET( d->xfd, &d->sn_vec[0].select_fds );
highest = QMAX( highest, d->xfd );
@@ -321,3 +321,9 @@ bool QEventLoop::hasPendingEvents() cons
extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
return ( qGlobalPostedEventsCount() || XPending( QPaintDevice::x11AppDisplay() ) );
}
+
+void QEventLoop::appStartingUp()
+{
+ if ( qt_is_gui_used && d->xfd == -1 ) // update d->xfd
+ d->xfd = XConnectionNumber( QPaintDevice::x11AppDisplay() );
+}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic