fix: complete Command presentation teardown
This commit is contained in:
@@ -192,8 +192,8 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
|
||||
}
|
||||
}
|
||||
|
||||
func close() {
|
||||
guard isShown else { return }
|
||||
func close(animated: Bool = true) {
|
||||
guard viewIfLoaded?.superview != nil, !isClosing || !animated else { return }
|
||||
transitionGeneration += 1
|
||||
let generation = transitionGeneration
|
||||
isClosing = true
|
||||
@@ -202,13 +202,23 @@ final class ApplicationActionsController: NSViewController, NSSearchFieldDelegat
|
||||
if let mouseMonitor { NSEvent.removeMonitor(mouseMonitor) }
|
||||
mouseMonitor = nil
|
||||
coveredPill?.setAccessibilityHidden(false)
|
||||
if !animated {
|
||||
view.removeFromSuperview()
|
||||
coveredPill?.layer?.removeAllAnimations()
|
||||
coveredPill?.alphaValue = coveredPillAlpha
|
||||
coveredPill = nil
|
||||
isClosing = false
|
||||
closed?()
|
||||
return
|
||||
}
|
||||
// Finish teardown even if the presenting Command releases this controller.
|
||||
NSAnimationContext.runAnimationGroup { context in
|
||||
context.duration = NSWorkspace.shared.accessibilityDisplayShouldReduceMotion ? 0 : 0.12
|
||||
view.animator().alphaValue = 0
|
||||
coveredPill?.animator().alphaValue = coveredPillAlpha
|
||||
} completionHandler: { [weak self] in
|
||||
} completionHandler: { [self] in
|
||||
MainActor.assumeIsolated {
|
||||
guard let self, self.transitionGeneration == generation, self.isClosing else { return }
|
||||
guard self.transitionGeneration == generation, self.isClosing else { return }
|
||||
self.view.removeFromSuperview()
|
||||
self.coveredPill = nil
|
||||
self.isClosing = false
|
||||
|
||||
Reference in New Issue
Block a user