phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp
branchRCL_3
changeset 15 34879f5cfc63
parent 9 0d28c1c5b6dd
--- a/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp	Wed Jun 09 09:26:27 2010 +0300
+++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp	Mon Jun 21 15:24:27 2010 +0300
@@ -101,6 +101,11 @@
 //
 CPmapContactEditorExtension::~CPmapContactEditorExtension()
     {
+    if(iCmd)
+        {
+        delete iCmd;
+        iCmd = NULL;
+        }
     }
 
 // --------------------------------------------------------------------------
@@ -170,16 +175,26 @@
         {
         case EPbk2ExtensionShowOnMap:
         	{
-        	MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
-        	// Execute the command
-        	cmd->ExecuteLD();
+        	if(iCmd)
+        	    {
+                delete iCmd;
+                iCmd = NULL;
+        	    }
+        	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
+        	// Execute the command 
+        	iCmd->ExecuteLD();
             return ETrue;
             }
         case EPbk2ExtensionAssignFromMap:
         	{
-        	MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
+        	if(iCmd)
+                {
+                delete iCmd;
+                iCmd = NULL;
+                }
+        	iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId );
         	// Execute the command
-        	cmd->ExecuteLD();
+        	iCmd->ExecuteLD();
             return ETrue;
             }
         default: