[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1099
Date       : Wed May 17 12:59:39 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/app.cpp

Fix idle handling - previously it was ignoring the return value of
low priority idle handlers, and assuming they should always require
more idles. This is demonstrably incorrect. This fixes Bug 1070 (100%
CPU usage)


Diff:
Index: Trunk/XaraLX/Kernel/app.cpp
===================================================================
--- Trunk/XaraLX/Kernel/app.cpp	(revision 1098)
+++ Trunk/XaraLX/Kernel/app.cpp	(revision 1099)
@@ -1437,7 +1437,7 @@
 	ListItemOpPtr *NextOp;
 
 	// If there are no registered processors, we'll return FALSE as idles aren't needed
-	BOOL MoreIdlesNeeded = CurrentOp != NULL;
+	BOOL MoreIdlesNeeded = FALSE;
 
 	while (CurrentOp != NULL)
 	{
@@ -1446,7 +1446,10 @@
 
 		// Call the handler, and if it claims idles, disable calling of low-priority handlers
 		if (CurrentOp->pOp->OnIdleEvent())
+		{
+			MoreIdlesNeeded = TRUE; // we need more idles
 			CallLowPriorityHandlers = FALSE;
+		}
 
 		CurrentOp = NextOp;
 	}
@@ -1455,14 +1458,12 @@
 	if (CallLowPriorityHandlers)
 	{
 		CurrentOp = (ListItemOpPtr*)IdleLowPriorityOps.GetHead();
-		if (CurrentOp != NULL)
-			MoreIdlesNeeded = TRUE;
 
 		while (CurrentOp != NULL)
 		{
 			// Remember the next item in the list now, in case this one deregisters itself
 			NextOp = (ListItemOpPtr *) IdleLowPriorityOps.GetNext(CurrentOp);				
-			CurrentOp->pOp->OnIdleEvent();
+			MoreIdlesNeeded = MoreIdlesNeeded || CurrentOp->pOp->OnIdleEvent();
 			CurrentOp = NextOp;
 		}
 	}


Xara