From 4dec07fc14aed74870ec5d1eb18888d255556c2a Mon Sep 17 00:00:00 2001 From: Till Adam Date: Thu, 21 Jul 2005 20:44:00 +0000 Subject: [PATCH] Don't unget messages we did not get ourselves. Antonio, does that help with the crash? CCBUG: 106030 svn path=/trunk/KDE/kdepim/; revision=437417 --- searchjob.cpp | 6 ++++-- searchjob.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/searchjob.cpp b/searchjob.cpp index 57ab116c9..a43a9ec5b 100644 --- a/searchjob.cpp +++ b/searchjob.cpp @@ -52,7 +52,8 @@ SearchJob::SearchJob( KMFolderImap* folder, ImapAccountBase* account, const KMSearchPattern* pattern, Q_UINT32 serNum ) : FolderJob( 0, tOther, (folder ? folder->folder() : 0) ), mFolder( folder ), mAccount( account ), mSearchPattern( pattern ), - mSerNum( serNum ), mRemainingMsgs( 0 ), mProgress( 0 ) + mSerNum( serNum ), mRemainingMsgs( 0 ), mProgress( 0 ), + mUngetCurrentMsg( false ) { } @@ -304,7 +305,7 @@ void SearchJob::slotSearchMessageArrived( KMMessage* msg ) int idx = -1; KMFolder * p = 0; KMMsgDict::instance()->getLocation( msg, &p, &idx ); - if ( idx != -1 ) + if ( idx != -1 && mUngetCurrentMsg ) mFolder->unGetMsg( idx ); } if ( mSerNum > 0 ) @@ -397,6 +398,7 @@ void SearchJob::slotSearchDataSingleMessage( KIO::Job* job, const QString& data KMFolder *aFolder = 0; KMMsgDict::instance()->getLocation( mSerNum, &aFolder, &idx ); assert(aFolder && (idx != -1)); + mUngetCurrentMsg = !mFolder->getMsgBase( idx )->isMessage(); KMMessage * msg = mFolder->getMsg( idx ); if ( needsDownload() ) { ImapJob *job = new ImapJob( msg ); diff --git a/searchjob.h b/searchjob.h index ed91cac4f..43297de4a 100644 --- a/searchjob.h +++ b/searchjob.h @@ -126,6 +126,7 @@ protected: uint mRemainingMsgs; // progress item for local searches KPIM::ProgressItem *mProgress; + bool mUngetCurrentMsg; };