harvester/common/inc/harvestdata.inl
branchRCL_3
changeset 19 b73252188534
parent 3 6752808b2036
--- a/harvester/common/inc/harvestdata.inl	Thu Jul 15 19:07:24 2010 +0300
+++ b/harvester/common/inc/harvestdata.inl	Thu Aug 19 10:20:41 2010 +0300
@@ -80,9 +80,55 @@
 //
 void CObjectDataArray::Append( CMdEObject* aMdeObject, CLocationData* aLocationData, CMdEQuery* aQuery )
     {
-    iMdeObjectArray.Append( aMdeObject );
-    iLocationArray.Append( aLocationData );
-    iQueryArray.Append( aQuery );
+    TInt mdeObjectIndex(KErrNone);
+    TInt locationDataIndex(KErrNone);
+    
+    mdeObjectIndex = iMdeObjectArray.Append( aMdeObject );
+    
+    if( mdeObjectIndex != KErrNone )
+        {
+        delete aMdeObject;
+        aMdeObject = NULL;
+        
+        delete aLocationData;
+        aLocationData = NULL;
+        
+        delete aQuery;
+        aQuery = NULL;
+        }
+    else
+        {
+        locationDataIndex = iLocationArray.Append( aLocationData );
+        
+        if( locationDataIndex != KErrNone )
+            {
+            iMdeObjectArray.Remove( mdeObjectIndex );
+            delete aMdeObject;
+            aMdeObject = NULL;
+            
+            delete aLocationData;
+            aLocationData = NULL;
+            
+            delete aQuery;
+            aQuery = NULL;
+            }
+        else
+            {
+            if( iQueryArray.Append( aQuery ) != KErrNone )
+                {
+                iMdeObjectArray.Remove( mdeObjectIndex );
+                delete aMdeObject;
+                aMdeObject = NULL;
+                
+                iLocationArray.Remove( locationDataIndex );
+                delete aLocationData;
+                aLocationData = NULL;
+                
+                delete aQuery;
+                aQuery = NULL;
+                }
+            }
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -96,8 +142,14 @@
         return;
         }
     delete iMdeObjectArray[aIndex];
+    iMdeObjectArray[aIndex] = NULL;
+    
     delete iLocationArray[aIndex];
+    iLocationArray[aIndex] = NULL;
+    
     delete iQueryArray[aIndex];
+    iQueryArray[aIndex] = NULL;
+    
     iMdeObjectArray.Remove( aIndex );
     iLocationArray.Remove( aIndex );
     iQueryArray.Remove( aIndex );