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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/jobs
From:       Till Adam <adam () kde ! org>
Date:       2009-04-12 15:35:49
Message-ID: 1239550549.246188.10020.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 952803 by tilladam:

Avoid premature deletion of jobs due to a secondary event loop.
Working around a probable Qt bug on OSX (at least).

 M  +10 -0     kjob.cpp  


--- trunk/KDE/kdelibs/kdecore/jobs/kjob.cpp #952802:952803
@@ -186,6 +186,13 @@
 bool KJob::exec()
 {
     Q_D(KJob);
+    // Usually this job would delete itself, via deleteLater() just after
+    // emitting result() (unless configured otherwise). Since we use an event
+    // loop below, that event loop will process the deletion event and we'll
+    // have been deleted when exec() returns. This crashes, so temporarily
+    // suspend autodeletion and manually do it afterwards.
+    const bool wasAutoDelete = isAutoDelete();
+    setAutoDelete( false );
     QEventLoop loop( this );
 
     connect( this, SIGNAL( result( KJob* ) ),
@@ -195,6 +202,9 @@
         loop.exec(QEventLoop::ExcludeUserInputEvents);
     }
 
+    if ( wasAutoDelete ) {
+        deleteLater();
+    }
     return ( d->error == NoError );
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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