installationservices/swi/source/swis/server/planner.cpp
branchRCL_3
changeset 17 741e5bba2bd1
parent 12 7ca52d38f8c3
child 25 7333d7932ef7
--- a/installationservices/swi/source/swis/server/planner.cpp	Tue Apr 27 16:46:15 2010 +0300
+++ b/installationservices/swi/source/swis/server/planner.cpp	Tue May 11 16:20:28 2010 +0300
@@ -231,6 +231,11 @@
 	// tree.
 	RPointerArray<CSisRegistryPackage> plannedPackages;
 	CleanupResetAndDestroy<RPointerArray<CSisRegistryPackage> >::PushL(plannedPackages);
+
+	// Add the root node in the planned packages, so that it is not added again (as a node in the tree)
+	// in case of a cyclic dependency.	
+	CSisRegistryPackage* rootPackage = CSisRegistryPackage::NewL(currentNode->PackageL());
+	plannedPackages.AppendL(rootPackage);
 	
 	while(ETrue)
 		{
@@ -350,6 +355,7 @@
 	{
 	// We are removing items from array (aProcessPackages)and thus require index 
 	// adjustment. But if loop run in reverse order there is no need to adjust the index
+	CleanupResetAndDestroyPushL(aPlannedPackages);
 	for (TInt i = aProcessPackages.Count() - 1; i >= 0; --i)
 		{
 		// Ignore already added package
@@ -392,6 +398,7 @@
 		aProcessPackages.Remove(i);
 		CleanupStack::PopAndDestroy(&registryEntry);
 		}
+	CleanupStack::Pop(&aPlannedPackages);
 	}
 
 /**
@@ -514,6 +521,7 @@
             User::Leave(err);
 		    }
 		}
+
 	CleanupStack::Pop(rootApplication);
 	
 	return rootApplication;
@@ -528,13 +536,14 @@
  */
 void CPlanner::ConfirmForUninstallL(CUninstallationNode& aNode, RPointerArray<CSisRegistryPackage>& aPlannedPackages)
 	{
+	CleanupResetAndDestroyPushL(aPlannedPackages);
 	aNode.SetIsPlanned(ETrue);
 
 	// aNode owns package therefore to transfer the ownership
 	// a copy of CSisRegistryPackage is made.
 	CSisRegistryPackage* package = CSisRegistryPackage::NewLC(aNode.PackageL());
 	aPlannedPackages.AppendL(package);
-	CleanupStack::Pop(package);
+	CleanupStack::Pop(2, &aPlannedPackages);
 	}
 
 /**