menucontentsrv/handlersrc/menuuninstalloperation.cpp
branchRCL_3
changeset 19 edd621764147
parent 12 502e5d91ad42
child 23 ace62b58f4b2
--- a/menucontentsrv/handlersrc/menuuninstalloperation.cpp	Tue Apr 27 16:57:49 2010 +0300
+++ b/menucontentsrv/handlersrc/menuuninstalloperation.cpp	Tue May 11 16:30:05 2010 +0300
@@ -33,7 +33,33 @@
 
 const TUid KMidletType = { 0x10210E26 };
 
-// ================= MEMBER FUNCTIONS =======================
+
+// ========================= LOCAL FUNCTIONS ===============
+
+// ---------------------------------------------------------
+// CleanupResetAndDestroy()
+// ---------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+    {
+    if( aObj )
+        {
+        static_cast<T*>( aObj )->ResetAndDestroy();
+        }
+    }
+
+// ---------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ---------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+    {
+    CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+    }
+
+// ========================= MEMBER FUNCTIONS ==============
 
 // ---------------------------------------------------------
 // CMenuUninstallOperation::~CMenuUninstallOperation
@@ -217,7 +243,7 @@
     iSisRegSession.InstalledUidsL( packageIds );
     
     RPointerArray< HBufC > packageFiles;
-    CleanupClosePushL( packageFiles );
+    CleanupResetAndDestroyPushL( packageFiles );
     
     for( TInt i = 0; i < packageIds.Count() && !found; ++i )
         {
@@ -239,7 +265,6 @@
 	                found = ETrue;
 	                }
 	            }
-	        packageFiles.ResetAndDestroy();
 	        CleanupStack::PopAndDestroy( &packageEntry );    
         	}
         }