featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp
changeset 15 3eacc0623088
parent 0 08ec8eefde2f
--- a/featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp	Fri Mar 19 10:00:55 2010 +0200
+++ b/featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp	Fri Apr 16 16:49:27 2010 +0300
@@ -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;
     }