featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
--- a/featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp	Fri Mar 12 15:51:02 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp	Mon Mar 15 12:46:30 2010 +0200
@@ -76,6 +76,11 @@
     iFeatMgrClient = new (ELeave) RFeatMgrClient;
     // Connect to Feature Manager server
     TInt err( iFeatMgrClient->Connect() );
+    if (err!=KErrNone)
+      {
+      delete iFeatMgrClient;
+      iFeatMgrClient=NULL;
+      }
     User::LeaveIfError(err);
 
     CActiveScheduler::Add( this );
@@ -112,12 +117,20 @@
         }
 
     iFeatures.Reset();
-    iFeatures.Append( aFeature );
-    TInt err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
+    TInt err=iFeatures.Append( aFeature );
+    if (err!=KErrNone)
+      {
+      return err;
+      }
+    err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
     if ( err == KErrNone )
     	{
         SetActive();
      	}
+    else
+      {
+      iFeatures.Reset();
+      }
      	    
     return err;
     }
@@ -135,7 +148,7 @@
 
     iFeatures.Reset();
     TInt count = aFeatures.Count();
-    
+    TInt err=KErrNone;
     for(TInt i = 0; i < count; i++ )
         {
         // Do not append duplicate entries
@@ -143,16 +156,24 @@
         TInt index = iFeatures.Find( uid, FindByUid );
         if( index == KErrNotFound )
             {
-            iFeatures.Append( uid );
+            err=iFeatures.Append( uid );
+            if (err!=KErrNone)
+              {
+              iFeatures.Reset();
+              return err;
+              }
             }
         }
 
-    TInt err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
+    err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
     if ( err == KErrNone )
     	{
         SetActive();
      	}
-    
+    else
+      {
+      iFeatures.Reset();
+      }
     return err;
     }