[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdecore
From: Aurélien Gâteau <agateau () kde ! org>
Date: 2010-12-06 14:08:20
Message-ID: 20101206140820.4A298AC8A4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1204252 by gateau:
Reverted "Do not crash if an job was deleted in a slot connected to result()"
David explanation:
"""
In addition, you added a guard in kjob.cpp itself, but what about the moc-
generated code in between? When deleting the sender, we then go back to the
signal emission code inside of a deleted object...
"""
M +1 -12 jobs/kjob.cpp
M +0 -18 tests/kjobtest.cpp
M +0 -2 tests/kjobtest.h
--- trunk/KDE/kdelibs/kdecore/jobs/kjob.cpp #1204251:1204252
@@ -24,13 +24,11 @@
#include "kjobuidelegate.h"
-#include <kdebug.h>
#include <kglobal.h>
#include <QEventLoop>
#include <QMap>
#include <QMetaType>
#include <QTimer>
-#include <QWeakPointer>
bool KJobPrivate::_k_kjobUnitEnumRegistered = false;
KJobPrivate::KJobPrivate()
@@ -304,9 +302,6 @@
Q_D(KJob);
d->isFinished = true;
- bool autoDelete = isAutoDelete();
- QWeakPointer<KJob> guard(this);
-
if ( d->eventLoop ) {
d->eventLoop->quit();
}
@@ -316,15 +311,9 @@
emit result( this );
- if ( autoDelete ) {
- Q_ASSERT( guard.data() );
- if ( guard.data() ) {
+ if ( isAutoDelete() )
deleteLater();
- } else {
- kWarning() << "Job was marked as autoDelete() but has already been deleted!";
}
- }
-}
void KJob::emitPercent( qulonglong processedAmount, qulonglong totalAmount )
{
--- trunk/KDE/kdelibs/kdecore/tests/kjobtest.cpp #1204251:1204252
@@ -303,24 +303,6 @@
m_outerJob->exec();
}
-void KJobTest::testDeletedInResult()
-{
- TestJob *job = new TestJob;
- job->setAutoDelete( false );
-
- connect( job, SIGNAL( result( KJob* ) ),
- this, SLOT( deleteJob( KJob* ) ) );
-
- job->start();
- loop.exec();
-}
-
-void KJobTest::deleteJob(KJob *job)
-{
- delete job;
- loop.quit();
-}
-
void KJobTest::slotStartInnerJob()
{
QTimer::singleShot( 100, this, SLOT( slotFinishOuterJob() ) );
--- trunk/KDE/kdelibs/kdecore/tests/kjobtest.h #1204251:1204252
@@ -79,11 +79,9 @@
void testKill();
void testDelegateUsage();
void testNestedExec();
- void testDeletedInResult();
void slotResult( KJob *job );
void slotFinished(KJob *job);
- void deleteJob(KJob *);
private:
QEventLoop loop;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic