cmmanager/cmmgr/Framework/Src/cmdlg.cpp
branchRCL_3
changeset 36 04408506c6e0
parent 26 0a9e01492035
child 55 fc7b30ed2058
--- a/cmmanager/cmmgr/Framework/Src/cmdlg.cpp	Tue May 25 13:08:02 2010 +0300
+++ b/cmmanager/cmmgr/Framework/Src/cmdlg.cpp	Wed Jun 09 10:07:12 2010 +0300
@@ -1060,7 +1060,7 @@
         {
         return;
         }
-
+    
     if ( cm->GetBoolAttributeL( ECmProtected ) ||
         ( iCmDestinationImpl && 
          iCmDestinationImpl->ProtectionLevel() == CMManager::EProtLevel1 ) )
@@ -1111,7 +1111,11 @@
         CleanupStack::PopAndDestroy( &destArray );
         return;
         }
-    
+
+    // create a copy of the current connection method
+    CCmPluginBase* cmCopy = cm->CreateCopyL();
+    CleanupStack::PushL( cmCopy );
+
     // ok, there is at least 1, pop up the dialog
     CSelectDestinationDlg* dlg = CSelectDestinationDlg::NewL( destId, 
                                                               *iCmManager, 
@@ -1123,14 +1127,9 @@
         CleanupStack::PushL( dest ); 
         if ( iCmDestinationImpl )
             {
-            // create a copy of the current connection method
-            CCmPluginBase* cmCopy = cm->CreateCopyL();
-            CleanupStack::PushL( cmCopy );
             // store it in commsdat
             cmCopy->UpdateL();
             dest->AddConnectionMethodL( *cmCopy );
-            
-            CleanupStack::PopAndDestroy( cmCopy );
             }
         else
             {
@@ -1147,7 +1146,7 @@
         CleanupStack::PopAndDestroy( dest );
         HandleListboxDataChangeL();                             
         }
-
+    CleanupStack::PopAndDestroy( cmCopy );
     CleanupStack::PopAndDestroy( &destArray );
     }