fix dead-loop in TrimQueue()

This commit is contained in:
Kang Yu 2025-04-14 21:20:21 -07:00
parent 62452f3e0b
commit de1b815d57

View file

@ -2214,7 +2214,7 @@ namespace PersistentWindows.Common
private void TrimQueue(string displayKey, IntPtr hwnd) private void TrimQueue(string displayKey, IntPtr hwnd)
{ {
while (monitorApplications[displayKey][hwnd].Count > MaxHistoryQueueLength) if (monitorApplications[displayKey][hwnd].Count > MaxHistoryQueueLength)
{ {
// limit length of snapshot capture history // limit length of snapshot capture history
ulong acc_flags = 0; ulong acc_flags = 0;
@ -2227,7 +2227,6 @@ namespace PersistentWindows.Common
{ {
Log.Event($"trim redundant snapshot record for {windowTitle[hwnd]}"); Log.Event($"trim redundant snapshot record for {windowTitle[hwnd]}");
monitorApplications[displayKey][hwnd].RemoveAt(i); monitorApplications[displayKey][hwnd].RemoveAt(i);
break;
} }
acc_flags |= snapshot_flags; acc_flags |= snapshot_flags;
} }