emailservices/emailstore/message_store/client/src/MsgStoreObserverHandler.cpp
branchRCL_3
changeset 24 d189ee25cf9d
parent 8 e1b6206813b4
child 25 3533d4323edc
--- a/emailservices/emailstore/message_store/client/src/MsgStoreObserverHandler.cpp	Thu Aug 19 09:38:05 2010 +0300
+++ b/emailservices/emailstore/message_store/client/src/MsgStoreObserverHandler.cpp	Tue Aug 31 15:04:17 2010 +0300
@@ -16,10 +16,10 @@
 */
 
 
-#include "msgstoreobserverhandler.h"
-#include "rmessagestoresession.h"
+#include "MsgStoreObserverHandler.h"
+#include "RMessageStoreSession.h"
 //<cmail>
-#include "msgstoreobserver.h"
+#include "MsgStoreObserver.h"
 //</cmail>
 
 
@@ -45,6 +45,8 @@
 	iSession( aSession )
 	{
 	__LOG_CONSTRUCT( "MsgClient", "CMsgStoreObserverHandler" )
+	//initialize variable to false.
+    iObjectDeleted = EFalse;
 	} // end constructor
 
 // ==========================================================================
@@ -57,6 +59,10 @@
 	iMailBoxObservers.Close();
 	iObservers.Close();
 		
+	//object is being deleted. Mark variable as true to cover case where delete
+	//has come while RunL was running and "AccountEventNotify" was called and
+	//has not completed.
+	iObjectDeleted = ETrue;
 	__LOG_DESTRUCT
 	} // end destructor
 
@@ -233,9 +239,15 @@
     	    eventPtr++;
             }
             
-    	// Get the next event(s).    	
-    	iSession.GetEvents( iStatus, iEventBuffer );
-    	SetActive();
+        //check that "this" object was not deleted by client during "AccountEventNotify".
+        //If object has been deleted there is no need to get session events and activate itself.
+        if ( !iObjectDeleted )
+            {
+            // Get the next event(s).       
+            iSession.GetEvents(iStatus, iEventBuffer);
+            SetActive();
+            }
+    	
 	    }
     else
     	{