vpnengine/vpnconnagt/src/vpnconnagt.cpp
changeset 21 5aacbb121f34
parent 19 c29f8e059978
child 26 74294b43d401
--- a/vpnengine/vpnconnagt/src/vpnconnagt.cpp	Mon May 03 13:28:39 2010 +0300
+++ b/vpnengine/vpnconnagt/src/vpnconnagt.cpp	Fri May 14 16:52:10 2010 +0300
@@ -89,13 +89,7 @@
     LOG(TName name;
     name.AppendFormat(_L("[0x%08x]"), this);
     Log::Printf(_L("%s Destructing VPN Connection Agent\n"),name.PtrZ()));
-
-    if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
-        {
-        delete iSipObserver;
-        iSipObserver = NULL;
-        }
-        
+    
     if ( iFeatureManagerInitialized )
         {
         // We can safely call UnInitializeLib as we have really intialized it.
@@ -107,6 +101,11 @@
     iServiceStartedCallback.Cancel();
     iConnectCompleteCallback.Cancel();
     iDisconnectCallback.Cancel();
+    
+    delete iSipObserver;
+    iSipObserver = NULL;
+    
+    LOG_("CVPNConnAgt::~CVPNConnAgt end");
     }
 
 // ---------------------------------------------------------------------------
@@ -133,19 +132,22 @@
     CAgentBase::ConstructL();
     iConnected = EFalse;
     iDisconnecting = EFalse;
-    LOG_("CVPNConnAgt::ReadConfigurationL EventMediator");
-    User::LeaveIfError(iEventMediator.Connect());
-        
+
     // Initialize Feature Manager.
     FeatureManager::InitializeLibL();  // Successfull call increases reference count
     iFeatureManagerInitialized = ETrue;
-   
+
     // Create CVpnSipObserver for communicating with SIP profile server via 
     // P&S keys for SIP de/re-registration. this pointer is passed to have call back.
     if ( FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn ) )
         {
+        LOG_("CVPNConnAgt::ConstructL FfImsDeregistrationInVpn");
         iSipObserver = CVpnSipObserver::NewL( *this );
         }
+
+    User::LeaveIfError(iEventMediator.Connect());
+
+    LOG_("CVPNConnAgt::ConstructL end");
     }
 
 // ---------------------------------------------------------------------------