realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp
branchRCL_3
changeset 1 dd3853b8dc3f
parent 0 307788aac0a8
child 4 c2e8c8b73582
--- a/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp	Tue Feb 02 01:03:15 2010 +0200
+++ b/realtimenetprots/sipfw/ProfileAgent/Server/Src/sipalrmigrationcontroller.cpp	Fri Feb 19 23:10:33 2010 +0200
@@ -329,9 +329,11 @@
 	PROFILE_DEBUG5("CSipAlrMigrCtrl::SendMigrationResult iap,allow,obsCount",
 				   aIapId,
 				   aAllowed,
-				   iObservers.Count())	
-
-	for (TInt i = 0; i < iObservers.Count(); ++i)
+				   iObservers.Count())
+	    
+	    //Get the initial count of Observers
+	    TInt count = iObservers.Count();;
+	    for (TInt i = 0; i < count; ++i)
 		{
 		MSipAlrMigrationObserver& obs = iObservers[i].iObserver;
 		TRAPD(err, if (aAllowed)
@@ -348,6 +350,15 @@
 			PROFILE_DEBUG4("MigrationIs(Dis)AllowedL leaves err,index", err, i)
 			obs.ErrorOccurred(err);
 			}
+		// Check the Observer Count. It may be possible that Profile Could Not
+		// be registered (if migration is allowed). In such cases error handling
+		// for profile will be done, which will move Profile into Un-registered State
+		// As the profile moves into Un-registered state, profile is detached from
+		// the list of Observer which AlrMigrationController maintains. This dynamically
+		// changes the Observer count.
+        if(iObservers.Count() < count)
+              i--;
+        count = iObservers.Count();
 		}
 	}