Fix for bug 2408. Improved feed engine robustness.
--- 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
--- 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<TUint> iFeedsUpdating;
// observers that will receive callbacks, not owning
RArray<MFeedEngineObserver*> iObservers;
--- 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;i<cnt;i++)
{
- iFeedsUpdating.Append(iSortedFeeds[i]);
+ iFeedsUpdating.Append(iSortedFeeds[i]->Uid());
}
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;i<iObservers.Count();i++)
+ TBool result = EFalse;
+ //DP2("** UpdateNextFeed: %S, ID: %u", &(info->Url()), 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;i<iObservers.Count();i++)
+ {
+ TRAP_IGNORE(iObservers[i]->FeedUpdateAllCompleteL(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;i<iSortedFeeds.Count();i++)
{
if (iSortedFeeds[i]->Uid() == 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);
}