Subject: [kdepim-runtime] agents/nepomukfeeder: itemsReceived may be called incrementally and after result. Both is not handled by the code.
Git commit 7036320cc413546e20d66185bef52910f452f0cf by Christian Mollekopf.
Committed on 18/02/2012 at 21:40.
Pushed by cmollekopf into branch 'master'.

itemsReceived may be called incrementally and after result. Both is not handled
by the code.

M +5 -2 agents/nepomukfeeder/feederqueue.cpp
M +1 -1 agents/nepomukfeeder/feederqueue.h

http://commits.kde.org/kdepim-runtime/7036320cc413546e20d66185bef52910f452f0cf

diff --git a/agents/nepomukfeeder/feederqueue.cpp
b/agents/nepomukfeeder/feederqueue.cpp
index baf3352..0bb564a 100644
--- a/agents/nepomukfeeder/feederqueue.cpp
+++ b/agents/nepomukfeeder/feederqueue.cpp
@@ -134,8 +134,7 @@ void FeederQueue::processNextCollection()

ItemFetchJob *itemFetch = new ItemFetchJob( mCurrentCollection, this );
itemFetch->fetchScope().setCacheOnly( true );
- connect( itemFetch, SIGNAL(itemsReceived(Akonadi::Item::List)), SLOT(
itemHeadersReceived(Akonadi::Item::List)) );
- connect( itemFetch, SIGNAL(result(KJob*)), SLOT(itemFetchResult(KJob*)) );
+ connect( itemFetch, SIGNAL(finished(KJob*)), SLOT(itemFetchResult(KJob*)) );
++mPendingJobs;
}

@@ -180,6 +179,10 @@ void FeederQueue::itemFetchResult(KJob* job)
if ( job->error() )
kWarning() << job->errorString();

+ Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob *>(job);
+ Q_ASSERT(fetchJob);
+ itemHeadersReceived(fetchJob->items());
+
--mPendingJobs;
if ( mPendingJobs == 0 && lowPrioQueue.isEmpty() ) { //Fetch jobs finished
but there were no items in the collection
mCurrentCollection = Collection();
diff --git a/agents/nepomukfeeder/feederqueue.h
b/agents/nepomukfeeder/feederqueue.h
index 3f5da76..d5c43eb 100644
--- a/agents/nepomukfeeder/feederqueue.h
+++ b/agents/nepomukfeeder/feederqueue.h
@@ -158,13 +158,13 @@ signals:
void running(QString);

private slots:
- void itemHeadersReceived( const Akonadi::Item::List &items );
void itemFetchResult( KJob* job );
void processItemQueue();
void prioQueueFinished();
void batchFinished();
void jobResult( KJob* job );
private:
+ void itemHeadersReceived( const Akonadi::Item::List &items );
void continueIndexing(); //start the indexing if work is to be done
void processNextCollection();
int mTotalAmount, mProcessedAmount, mPendingJobs;

(C)2011 mailinglist-archive.com