fix: app crash from v7.13.0 (closes #4016)

This commit is contained in:
lwouis committed 2024-12-24 09:55:20 +01:00
1 parent 4481d94fa2
commit d3b5befe3e
1 file changed
+9 -10
+9 -10
View File
@@ -251,16 +251,15 @@ class Windows {
for (index, cgWindowId) in Spaces.windowsInSpaces(Spaces.visibleSpaces).enumerated() { for (index, cgWindowId) in Spaces.windowsInSpaces(Spaces.visibleSpaces).enumerated() {
windowLevelMap[cgWindowId] = index windowLevelMap[cgWindowId] = index
} }
var orderForUnlistedWindows = Int.max list = list
for window in list { .sorted { w1, w2 in
if let listedOrder = windowLevelMap[window.cgWindowId] { (windowLevelMap[w1.cgWindowId] ?? .max) < (windowLevelMap[w2.cgWindowId] ?? .max)
window.lastFocusOrder = listedOrder }
} else { .enumerated()
window.lastFocusOrder = orderForUnlistedWindows .map { (index, window) -> Window in
orderForUnlistedWindows -= 1 window.lastFocusOrder = index
} return window
} }
list.sort { $0.lastFocusOrder < $1.lastFocusOrder }
} }
static func refreshThumbnailsAsync(_ screen: NSScreen, _ currentIndex: Int) { static func refreshThumbnailsAsync(_ screen: NSScreen, _ currentIndex: Int) {