[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    QApplication dtor change breaks KDE applications
From:       Malte Starostik <malte () kde ! org>
Date:       2003-07-08 1:26:54
[Download RAW message or body]


Hi,

the addition of
is_app_closing = FALSE;
in QApplication::~QApplication() (qapplication.cpp:1093) causes invalid memory 
references during shutdown in some KDE applications, most notably konqueror. 
In my particular case the usual symptom is konqueror hanging around with 100% 
CPU usage in KDE's malloc replacement.
Here is what happens:
* QApplication is destroyed and sets is_app_closing to true in it's dtor
* later on, is_app_closing is reset to false (why?)
* control is passed to QObject::~QObject (QApplication's base dtor)
* child objects are destroyed, including KIO::Scheduler
* KIO::Scheduler destroys its slaves, which destroy a QSocketNotifier
* QSocketNotifier::~QSocketNotifier calls setEnabled( false ) which gets here:
    QEventLoop *eventloop = QApplication::eventLoop();
    if ( ! eventloop ) // perhaps application is shutting down
        return;

QApplication::eventLoop():
    if ( !eventloop && !is_app_closing )
        (void) new QEventLoop( qApp, "default event loop" );

But since QApplication's dtor reset is_app_closing before we arrived here, a 
new event loop is constructed instead of returning null. This results in an 
invalid reference to the already-closed X11 display when the event loop is 
initialized.

Thanks for fixing,
-Malte

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic