# HG changeset patch # User teknolog # Date 1270291646 -3600 # Node ID 04c6ccce8e7e00eaa82f746482d265a8688faba4 # Parent 867fc277ffea5dca05dcaf60c374540dc37ccfac Fix for bug 2408. Improved feed engine robustness. diff -r 867fc277ffea -r 04c6ccce8e7e application/src/PodcastFeedView.cpp --- a/application/src/PodcastFeedView.cpp Sat Apr 03 10:55:45 2010 +0100 +++ b/application/src/PodcastFeedView.cpp Sat Apr 03 11:47:26 2010 +0100 @@ -696,7 +696,7 @@ { info->SetTitleL(title); info->SetCustomTitle(); - iPodcastModel.FeedEngine().UpdateFeedL(info); + iPodcastModel.FeedEngine().UpdateFeedInfoL(info); UpdateListboxItemsL(); } } @@ -955,10 +955,6 @@ { DP("CPodcastListView::HandleLongTapEventL BEGIN"); - if (iUpdatingAllRunning) { - return; // we don't allow feed manipulation while update is running - } - iListContainer->SetLongTapDetectedL(ETrue); const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 diff -r 867fc277ffea -r 04c6ccce8e7e engine/inc/FeedEngine.h --- a/engine/inc/FeedEngine.h Sat Apr 03 10:55:45 2010 +0100 +++ b/engine/inc/FeedEngine.h Sat Apr 03 11:47:26 2010 +0100 @@ -78,7 +78,7 @@ void RunFeedTimer(); - IMPORT_C void UpdateFeedL(CFeedInfo *aItem); + IMPORT_C void UpdateFeedInfoL(CFeedInfo *aItem); /** * Returns the current internal state of the feed engine4 */ @@ -147,7 +147,7 @@ CFeedInfo *iActiveFeed; TFileName iUpdatingFeedFileName; TFileName iSearchResultsFileName; - RFeedInfoArray iFeedsUpdating; + RArray iFeedsUpdating; // observers that will receive callbacks, not owning RArray iObservers; diff -r 867fc277ffea -r 04c6ccce8e7e engine/src/FeedEngine.cpp --- a/engine/src/FeedEngine.cpp Sat Apr 03 10:55:45 2010 +0100 +++ b/engine/src/FeedEngine.cpp Sat Apr 03 11:47:26 2010 +0100 @@ -148,7 +148,7 @@ TInt cnt = iSortedFeeds.Count(); for (int i=0;iUid()); } UpdateNextFeedL(); @@ -168,20 +168,31 @@ { DP1("UpdateNextFeed. %d feeds left to update", iFeedsUpdating.Count()); + // reset active feed, will be set again in UpdateFeedL if needed + iActiveFeed = NULL; + if (iFeedsUpdating.Count() > 0) { - CFeedInfo *info = iFeedsUpdating[0]; + CFeedInfo *info = GetFeedInfoByUid(iFeedsUpdating[0]); iFeedsUpdating.Remove(0); - TBool result = EFalse; - //DP2("** UpdateNextFeed: %S, ID: %u", &(info->Url()), info->Uid()); - TRAPD(error, result = UpdateFeedL(info->Uid())); - if (error != KErrNone || !result) + if (info == NULL) + { + UpdateNextFeedL(); + } + else { - DP("Error while updating all feeds"); - for (TInt i=0;iUrl()), info->Uid()); + TRAPD(error, result = UpdateFeedL(info->Uid())); + + if (error != KErrNone || !result) { - TRAP_IGNORE(iObservers[i]->FeedUpdateAllCompleteL(iAutoUpdatedInitiator?MFeedEngineObserver::EFeedAutoUpdate:MFeedEngineObserver::EFeedManualUpdate)); + DP("Error while updating all feeds"); + for (TInt i=0;iFeedUpdateAllCompleteL(iAutoUpdatedInitiator?MFeedEngineObserver::EFeedAutoUpdate:MFeedEngineObserver::EFeedManualUpdate)); + } } } } @@ -198,6 +209,12 @@ EXPORT_C TBool CFeedEngine::UpdateFeedL(TUint aFeedUid) { DP("FeedEngine::UpdateFeedL BEGIN"); + + if (iActiveFeed) + { + User::Leave(KErrInUse); + } + iActiveFeed = GetFeedInfoByUid(aFeedUid); iCatchupCounter = 0; iCancelRequested = EFalse; @@ -363,6 +380,11 @@ EXPORT_C void CFeedEngine::RemoveFeedL(TUint aUid) { + if (iActiveFeed && iActiveFeed->Uid() == aUid) + { + User::Leave(KErrInUse); + } + for (int i=0;iUid() == aUid) @@ -510,16 +532,6 @@ switch(iClientState) { - default: - if(iActiveFeed != NULL) - { - TTime time; - time.HomeTime(); - iActiveFeed->SetLastUpdated(time); - iActiveFeed->SetLastError(aError); - NotifyFeedUpdateComplete(iActiveFeed->Uid(), aError); - } - break; case EUpdatingFeed: { // Parse the feed. We need to trap this call since it could leave and then @@ -633,6 +645,9 @@ BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName); }break; + default: + User::Panic(_L("FeedEngine"), KErrUnknown); + break; } DP("CFeedEngine::CompleteL END"); } @@ -1020,8 +1035,13 @@ return feedInfo; } -EXPORT_C void CFeedEngine::UpdateFeedL(CFeedInfo *aItem) +EXPORT_C void CFeedEngine::UpdateFeedInfoL(CFeedInfo *aItem) { + if (iActiveFeed && iActiveFeed->Uid() == aItem->Uid()) + { + User::Leave(KErrInUse); + } + DBUpdateFeedL(*aItem); }