idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp
branchRCL_3
changeset 31 8baec10861af
parent 30 a5a39a295112
--- a/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp	Wed Sep 01 12:22:09 2010 +0100
+++ b/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp	Tue Sep 14 21:55:16 2010 +0300
@@ -241,7 +241,9 @@
           if ( icon != NULL ) // Syntax correct but icon not found
               {
               aObserver->PublishPtr( *this, aContentId, icon , aContentId );
-              iIconArray.Append(icon);
+              CleanupStack::PushL( icon );
+              iIconArray.AppendL( icon );
+              CleanupStack::Pop( icon );
               } 
           else
               {
@@ -285,6 +287,7 @@
                 {
                 // Take the ownership
                 CGulIcon* icon = CGulIcon::NewL(bitmap);
+                CleanupStack::PushL( icon );
                 if( aMaskHandle != KErrBadHandle )
                     {
                     CFbsBitmap* mask = new (ELeave) CFbsBitmap();
@@ -294,7 +297,8 @@
                         }
                     }
                 aObserver->PublishPtr( *this, aContentId, icon , aContentId );
-                iIconArray.Append(icon);
+                iIconArray.AppendL( icon );
+                CleanupStack::Pop( icon );
                 }
             else
                 {
@@ -484,8 +488,6 @@
 void CSapiDataPlugin::Stop( TStopReason aReason )
     {
     TRAP_IGNORE( StopL( aReason ) );
-    
-    iPluginState = EStopped;
     }
 
 // ----------------------------------------------------------------------------
@@ -495,23 +497,28 @@
 //
 void CSapiDataPlugin::StopL( TStopReason aReason )
     {
-    if ( aReason == ESystemShutdown )
+    if ( iPluginState != EStopped )
         {
-        iData->ChangePublisherStatusL( KSystemShutdown );
-        }
-    else if ( aReason == EPageShutdown )
-        {
-        iData->ChangePublisherStatusL( KPageShutdown );
+        if ( aReason == ESystemShutdown )
+            {
+            iData->ChangePublisherStatusL( KSystemShutdown );
+            }
+        else if ( aReason == EPageShutdown )
+            {
+            iData->ChangePublisherStatusL( KPageShutdown );
+            }
+        else if ( aReason == EPluginShutdown )
+            {
+            iData->ChangePublisherStatusL( KPluginShutdown );
+            }
+    
+        if ( iData )
+            {
+            iData->ChangePublisherStatusL( KDeActive );
+            }
+        
+        iPluginState = EStopped;
         }
-    else if ( aReason == EPluginShutdown )
-        {
-        iData->ChangePublisherStatusL( KPluginShutdown );
-        }
-
-    if ( iData )
-        {
-        iData->ChangePublisherStatusL( KDeActive );
-        }          
     }
 
 // ----------------------------------------------------------------------------