harvester/client/src/harvesterclientao.cpp
branchRCL_3
changeset 47 b73252188534
parent 46 63c982fb92f2
child 49 f23c07ec56e2
--- a/harvester/client/src/harvesterclientao.cpp	Thu Jul 15 19:07:24 2010 +0300
+++ b/harvester/client/src/harvesterclientao.cpp	Thu Aug 19 10:20:41 2010 +0300
@@ -97,19 +97,16 @@
 // RemoveObserver
 // ---------------------------------------------------------------------------
 //	
-void CHarvesterClientAO::RemoveObserver( MHarvestObserver* aObserver )
+void CHarvesterClientAO::RemoveObserver( MHarvestObserver* /*aObserver*/ )
 	{
 	WRITELOG( "CHarvesterClientAO::RemoveObserver()" );
-	OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_REMOVEOBSERVER, "CHarvesterClientAO::RemoveObserver" );
-	
-	if ( aObserver == iObserver )
-		{
-		if ( iObserver )
-			{
-			WRITELOG( "CHarvesterClientAO::RemoveObserver() - deleting observer" );
-			iObserver = NULL;
-			}
-		}
+    if ( iObserver )
+        {
+        WRITELOG( "CHarvesterClientAO::RemoveObserver() - deleting observer" );
+        iObserver = NULL;
+        }
+    
+    Cancel();
 	}
 
 // ---------------------------------------------------------------------------
@@ -120,7 +117,7 @@
 	{
 	WRITELOG( "CHarvesterClientAO::DoCancel()" );
 	OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_DOCANCEL, "CHarvesterClientAO::DoCancel" );
-	
+	iHarvesterClient.UnregisterHarvestComplete();
 	}
 	
 // ---------------------------------------------------------------------------
@@ -129,7 +126,7 @@
 //
 void CHarvesterClientAO::Active()
 	{	
-	if (!IsActive())
+	if ( iObserver && !IsActive())
 		{
 		iHarvesterClient.RegisterHarvestComplete(iURI, iStatus);
 		SetActive();
@@ -144,7 +141,6 @@
 	{
 	WRITELOG( "CHarvesterClientAO::RunL()" );
 	OstTrace0( TRACE_NORMAL, CHARVESTERCLIENTAO_RUNL, "CHarvesterClientAO::RunL" );
-	
 
 	const TInt status = iStatus.Int();
 	
@@ -161,7 +157,7 @@
 		}
 	
 	// if the request was not canceled or server is not terminated, Activating AO again
-	if ( status != KErrCancel && status != KErrServerTerminated )
+	if ( status != KErrCancel && status != KErrServerTerminated && iObserver )
 		{
 		Active();
 		}