backupandrestore/backupengine/src/absession.cpp
changeset 31 a26669f87b46
parent 29 3ae5cb0b4c02
child 47 63cf70d3ecd8
--- a/backupandrestore/backupengine/src/absession.cpp	Fri Jun 25 16:54:01 2010 +0800
+++ b/backupandrestore/backupengine/src/absession.cpp	Fri Jul 09 17:58:21 2010 +0800
@@ -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()