diff -r 8466d47a6819 -r 12c456ceeff2 emailuis/emailui/src/FSComposerFetchLogic.cpp
--- a/emailuis/emailui/src/FSComposerFetchLogic.cpp Thu Dec 17 08:39:21 2009 +0200
+++ b/emailuis/emailui/src/FSComposerFetchLogic.cpp Thu Jan 07 12:38:38 2010 +0200
@@ -205,33 +205,35 @@
{
FUNC_LOG;
- if ( !iError && aEvent.iError )
+ // Ignore all responses when cancelling is in progress.
+ if ( !iFetchingCancelGoingOn )
{
- // Cancel all fetching when first error occurs
- iError = aEvent.iError;
- if(!iFetchingCancelGoingOn) // if cancelling not going on, start now
+ if ( !iError && aEvent.iError )
+ {
+ // Cancel all fetching when first error occurs
+ iError = aEvent.iError;
CancelFetchings();
- }
+ }
+ else if ( TFsEmailUiUtility::IsCompleteOrCancelEvent( aEvent ) )
+ {
+ // Remove the completed/failed download item
+ for ( TInt i=0; i during consecutive calls to CancelDownloadL, iParts contents don't remain same.
- // changing this so that it works even with varying contents in iParts
- TInt count = iParts.Count();
- TInt currentCount = count;
- while (count)
+ if ( iAppUi.DownloadInfoMediator() )
{
- TInt error( KErrNone );
- if ( iAppUi.DownloadInfoMediator() )
- {
- TRAP( error, iAppUi.DownloadInfoMediator()->CancelDownloadL( iParts[0].iMessagePartId ) );
- currentCount = iParts.Count();
- if(currentCount>=count)
- iParts.Remove(0);
- count = currentCount;
- //
- }
- if ( error )
+ // Note that we don't bother removing anything from iParts now; they
+ // will be cleaned up later.
+ for ( TInt i = iParts.Count() - 1; i >= 0; i-- )
{
+ TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelDownloadL( iParts[i].iMessagePartId ) );
}
}
+
//
- if(!iRequestCompleted)
+ if( !iRequestCompleted )
{
- iObserver.FetchLogicComplete( iState, KErrCancel );
+ if ( iObserver.FetchLogicComplete( iState, KErrCancel ))
+ {
+ // If the observer deleted this object, don't try to do anything
+ // else.
+ return;
+ }
iRequestCompleted = ETrue; //so that no stray events from plugins can cause panic
}
+
iFetchingCancelGoingOn = EFalse;
//
}