backupandrestore/backupengine/src/absession.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
parent 15 f85613f12947
child 20 4a793f564d72
--- a/backupandrestore/backupengine/src/absession.cpp	Thu Aug 19 10:44:03 2010 +0300
+++ b/backupandrestore/backupengine/src/absession.cpp	Tue Aug 31 16:03:15 2010 +0300
@@ -148,7 +148,12 @@
 		iCallbackWatchdog = NULL;
 		
 		// Remove this session from the server's session map
-		Server().RemoveElement(iClientSID);
+		// Use dynamic_cast in case that ABServer is deconstructing 
+		CABServer *pServer = dynamic_cast<CABServer*>(const_cast<CServer2*>(CSession2::Server()));
+		if(pServer)
+			{
+			pServer->RemoveElement(iClientSID);
+			}		
 		
 		// Clear up any outstanding message
 		HandleIPCClosingDownCallback();
@@ -159,7 +164,10 @@
 		// If the client has detached properly, they should
 		// have done this - but just in case.
 		//DoCancelWaitForCallback();
-		Server().DropSession();
+		if(pServer)
+			{
+			pServer->DropSession();
+			}
 		}
 		
 	void CABSession::CreateL()