uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
branchRCL_3
changeset 7 88b23e2e82e1
parent 6 10534483575f
child 8 46927d61fef3
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Mon Mar 15 12:43:37 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Wed Mar 31 23:03:58 2010 +0300
@@ -324,7 +324,7 @@
 
     if (iFreeingMemory)
             {
-            TRACES("OOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
+            TRACES("GOOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
             return;
             }
     
@@ -339,6 +339,8 @@
 
     TInt memoryEstimate = iMonitor.GetFreeMemory(); // The amount of free memory we expect to be free after the currently initiated operations
 
+    TRACES2("GOOMWATCHER:CGOomActionList::FreeMemory Memory currentActionIndex %d iActionrefsCount %d", iCurrentActionIndex, iActionRefs.Count());
+    
     while (iCurrentActionIndex < iActionRefs.Count())
         {
         if(iActionRefs[iCurrentActionIndex].Priority() > aMaxPriority)
@@ -360,6 +362,8 @@
             
             TInt32 fgApp = wgName->AppUid().iUid;
             TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue);
+            
+            CleanupStack::PopAndDestroy();
             if(appId == fgApp)
                 {
                 TRACES1("Foreground App wgid %x, spared by GOOM", appId);
@@ -404,11 +408,18 @@
             // Also check if we estimate that we have already freed enough memory (assuming that the sync mode is "estimate"
             {
             // Return from the loop - we will be called back (in CGOomActionList::StateChanged()) when the running actions complete
+            iCurrentActionIndex++;
             TRACES("CGOomActionList::FreeMemory: Exiting run action loop");
             return;
             }
         // ... otherwise continue running actions, don't wait for any existing ones to complete
         iCurrentActionIndex++;
+        
+        if (iCurrentActionIndex >= iActionRefs.Count())
+            {
+            StateChanged();
+            return;
+            }
         }
 
 
@@ -610,7 +621,6 @@
             {            
             TRACES2("CGOomActionList::StateChanged: Finished Action %d out of %d",iCurrentActionIndex, iActionRefs.Count());
             
-            iCurrentActionIndex++;
             
             if (iCurrentActionIndex >= iActionRefs.Count())
                 {