mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: crash in very rare data-race
Most common crash in AppCenter for v6.12.0: closure #1 () -> () in static AltTab.Windows.refreshThumbnailsAsync(__C.NSScreen, Swift.Int) -> ()
This commit is contained in:
+16
-14
@@ -158,23 +158,25 @@ class Windows {
|
||||
}
|
||||
|
||||
static func refreshThumbnailsAsync(_ screen: NSScreen, _ currentIndex: Int = criticalFirstThumbnails) {
|
||||
if !App.app.appIsBeingUsed || Preferences.hideThumbnails { return }
|
||||
BackgroundWork.mainQueueConcurrentWorkQueue.async {
|
||||
if currentIndex < list.count {
|
||||
let window = list[currentIndex]
|
||||
if window.shouldShowTheUser {
|
||||
window.refreshThumbnail()
|
||||
DispatchQueue.main.async {
|
||||
let view = ThumbnailsView.recycledViews[currentIndex]
|
||||
if view.thumbnail.image != window.thumbnail {
|
||||
let oldSize = view.thumbnail.frame.size
|
||||
view.thumbnail.image = window.thumbnail
|
||||
view.thumbnail.image?.size = oldSize
|
||||
view.thumbnail.frame.size = oldSize
|
||||
DispatchQueue.main.async {
|
||||
if !App.app.appIsBeingUsed || Preferences.hideThumbnails { return }
|
||||
BackgroundWork.mainQueueConcurrentWorkQueue.async {
|
||||
if currentIndex < list.count {
|
||||
let window = list[currentIndex]
|
||||
if window.shouldShowTheUser {
|
||||
window.refreshThumbnail()
|
||||
DispatchQueue.main.async {
|
||||
let view = ThumbnailsView.recycledViews[currentIndex]
|
||||
if view.thumbnail.image != window.thumbnail {
|
||||
let oldSize = view.thumbnail.frame.size
|
||||
view.thumbnail.image = window.thumbnail
|
||||
view.thumbnail.image?.size = oldSize
|
||||
view.thumbnail.frame.size = oldSize
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshThumbnailsAsync(screen, currentIndex + 1)
|
||||
}
|
||||
refreshThumbnailsAsync(screen, currentIndex + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user