metadataengine/client/src/mdesessionimpl.cpp
changeset 23 33ae025ac1e8
parent 21 50bf9db68373
child 28 c461c7fa72c2
--- a/metadataengine/client/src/mdesessionimpl.cpp	Fri Apr 16 15:23:55 2010 +0300
+++ b/metadataengine/client/src/mdesessionimpl.cpp	Mon May 03 12:55:01 2010 +0300
@@ -42,6 +42,9 @@
 #include "mdeobjectcondition.h"
 #include "mdscommoninternal.h"
 
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 RMdESessionAsyncRequest::RMdESessionAsyncRequest( TRequestType aRequestType, 
 	CMdCSerializationBuffer* aBuffer, CMdCSerializationBuffer& aResultBuffer,
 	TRequestStatus& aRequestStatus) : 
@@ -1840,6 +1843,8 @@
 		CMdCSerializationBuffer& aBuffer, 
 		RPointerArray<CMdEInstanceItem>& aItems )
 	{
+    CleanupResetAndDestroyPushL( aItems );
+    
 	const TMdCItems& items = TMdCItems::GetFromBufferL( aBuffer );
 
     CMdENamespaceDef& namespaceDef = GetNamespaceDefL( items.iNamespaceDefId );
@@ -1881,6 +1886,8 @@
 			CleanupStack::Pop( relation );
 			}
 		}
+	
+	CleanupStack::Pop( &aItems );
 	}
 
 TItemId CMdESessionImpl::AddObjectL( CMdEObject& aObject )
@@ -2276,8 +2283,8 @@
     CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -2303,8 +2310,8 @@
     notifier->RegisterL( EObjectNotifyPresent | EObjectNotifyNotPresent,
     		&aObserver, NULL, namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.AppendL( notifier );
 	}
 
 void CMdESessionImpl::AddRelationObserverL( MMdERelationObserver& aObserver,
@@ -2359,8 +2366,8 @@
     CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -2416,8 +2423,8 @@
 	CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
 	notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 	
+	iNotifiers.AppendL( notifier );
 	CleanupStack::Pop( notifier );
-	iNotifiers.AppendL( notifier );
 	
     CleanupStack::PopAndDestroy( aCondition );
 	}
@@ -2445,8 +2452,8 @@
     notifier->RegisterL( ERelationNotifyPresent | ERelationNotifyNotPresent,
     		&aObserver, NULL, namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.AppendL( notifier );
 	}
 
 void CMdESessionImpl::AddEventObserverL( MMdEEventObserver& aObserver,
@@ -2502,8 +2509,8 @@
     CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.AppendL( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -2527,7 +2534,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2549,7 +2555,6 @@
     		&aObserver, namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2580,7 +2585,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2612,7 +2616,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2634,7 +2637,6 @@
     		&aObserver, namespaceDef );
     if ( index != KErrNotFound )
         {
-    	iNotifiers[index]->Cancel();
     	delete iNotifiers[index];
     	iNotifiers[index] = NULL;
     	iNotifiers.Remove( index );
@@ -2664,7 +2666,6 @@
     		&aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-	    iNotifiers[index]->Cancel();
 	    delete iNotifiers[index];
 	    iNotifiers[index] = NULL;
 	    iNotifiers.Remove( index );
@@ -2891,6 +2892,8 @@
 void CMdESessionImpl::GetItemIdL( CMdCSerializationBuffer* aBuffer, 
 		RArray<TItemId>& aIdArray )
 	{
+    CleanupClosePushL( aIdArray );
+    
 	const TMdCItemIds& itemIds = TMdCItemIds::GetFromBufferL( *aBuffer );
 
 	if( itemIds.iObjectIds.iPtr.iCount > 0 ) 
@@ -2917,6 +2920,8 @@
 	    aBuffer->ReceiveL( id );
 	    aIdArray.AppendL( id );
 	    }
+	
+	CleanupStack::Pop( &aIdArray );
 	}
 
 void CMdESessionImpl::GetDistinctValuesL( CMdCSerializationBuffer& aBuffer, 
@@ -2996,8 +3001,8 @@
     CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
     notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
 
+    iNotifiers.AppendL( notifier );
     CleanupStack::Pop( notifier );
-    iNotifiers.Append( notifier );
     
     CleanupStack::PopAndDestroy( aCondition );
     }
@@ -3021,7 +3026,6 @@
             &aObserver, *namespaceDef );
     if ( index != KErrNotFound )
         {
-        iNotifiers[index]->Cancel();
         delete iNotifiers[index];
         iNotifiers[index] = NULL;
         iNotifiers.Remove( index );