videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp
changeset 1 6711b85517b7
parent 0 96612d01cf9f
child 8 ce5ada96ab30
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp	Mon Jan 18 20:21:12 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp	Tue Jan 26 12:00:59 2010 +0200
@@ -68,6 +68,8 @@
     
     delete iVideoList;
     delete iDownloadCache;
+    delete iCenRep;
+    
     DeletePartialList();
     }
 
@@ -1317,17 +1319,18 @@
 //    
 TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL()
     {
-    TUid uid;
-    uid.iUid = KVcxMyVideosCollectionCenrepUid;
-    CRepository* cenRep = CRepository::NewL( uid );
-    CleanupStack::PushL( cenRep ); // 1->
+
+    if( !iCenRep ) 
+        {
+        TUid uid;
+        uid.iUid = KVcxMyVideosCollectionCenrepUid;
+		iCenRep = CRepository::NewL( uid );
+        }
     
     TInt sortingOrderInCenrep;
 
-    TInt cenRepError = cenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
+    TInt cenRepError = iCenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
             sortingOrderInCenrep );
-
-    CleanupStack::PopAndDestroy( cenRep ); // <-1
     
     TVcxMyVideosSortingOrder sortingOrder;