harvester/server/src/ondemandao.cpp
changeset 54 a3cc46f37772
parent 0 c53acadfccc6
--- a/harvester/server/src/ondemandao.cpp	Tue Jul 06 14:44:37 2010 +0300
+++ b/harvester/server/src/ondemandao.cpp	Fri Sep 17 16:54:49 2010 +0300
@@ -64,6 +64,7 @@
 	if( iMdEHarvesterSession )
 		{
 		delete iMdEHarvesterSession;
+		iMdEHarvesterSession = NULL;
 		}
 	// Delete instance variables if any
 	}
@@ -71,7 +72,7 @@
 void COnDemandAO::DoCancel()
 	{
 	WRITELOG("COnDemandAO::DoCancel");
-	iMdEHarvesterSession->CancelHarvestingPrioritizationObserver ();
+	iMdEHarvesterSession->CancelHarvestingPrioritizationObserver();
 	}
 
 void COnDemandAO::StartL()
@@ -79,7 +80,7 @@
 	WRITELOG("COnDemandAO::StartL");
 	// Cancel any request, just to be sure
 	Cancel ();
-	iMdEHarvesterSession->SetHarvestingPrioritizationChunkL ( 16384 );
+	iMdEHarvesterSession->SetHarvestingPrioritizationChunkL( 16384 );
 	WaitHarvestingRequest ();
 	}
 
@@ -115,8 +116,14 @@
 							hd->SetEventType( EHarvesterEdit );
 							hd->SetObjectType( EFastHarvest );
 							queue.Remove( k );
-							queue.Insert( hd, 0 );
-							found = ETrue;
+
+							if(queue.Insert( hd, 0 ) != KErrNone)
+							    {
+                                delete hd;
+                                hd = NULL;
+							    }
+							
+                            found = ETrue;
 							}							
 						}
 					}