fix: crash from appcenter in rare scenario
Stack trace: closure #1 () -> () in AltTab.(windowDestroyed in _3E1A2D100A6A10BAACF80B17AC9C41B5)(__C.AXUIElementRef) throws -> () Windows.swift:43 reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () <compiler-generated>:0
This commit is contained in:
1 parent
6edced005a
commit
c49a2bcd4b
2 files changed
+4
-4
No files matched your search
@@ -94,10 +94,10 @@ class Windows {
|
||||
return targetIndex
|
||||
}
|
||||
|
||||
static func moveFocusedWindowIndexAfterWindowDestroyedInBackground(_ destroyedWindowIndex: Int) {
|
||||
if focusedWindowIndex > destroyedWindowIndex {
|
||||
static func moveFocusedWindowIndexAfterWindowDestroyedInBackground(_ window: Window) {
|
||||
if focusedWindowIndex > window.lastFocusOrder {
|
||||
cycleFocusedWindowIndex(-1)
|
||||
} else if focusedWindowIndex == destroyedWindowIndex && !focusedWindow()!.shouldShowTheUser {
|
||||
} else if focusedWindowIndex == window.lastFocusOrder && !window.shouldShowTheUser {
|
||||
cycleFocusedWindowIndex(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ private func windowDestroyed(_ element: AXUIElement) throws {
|
||||
Windows.removeAndUpdateFocus(window)
|
||||
let windowlessApp = window.application.addWindowslessAppsIfNeeded()
|
||||
if Windows.list.count > 0 {
|
||||
Windows.moveFocusedWindowIndexAfterWindowDestroyedInBackground(window.lastFocusOrder)
|
||||
Windows.moveFocusedWindowIndexAfterWindowDestroyedInBackground(window)
|
||||
App.app.refreshOpenUi(windowlessApp)
|
||||
} else {
|
||||
App.app.hideUi()
|
||||
|
||||
Reference in new issue
Block a user