fix: win.closeFilePreview recreates panel when called twice (#45319)

* fix: close quick look during tests on macOS

* use longer delay 🤷

* fix: sharedPreviewPanel being recreated on close

* test: ensure preview panel gets closed
This commit is contained in:
Sam Maddock 2025-02-17 17:25:19 -05:00 committed by GitHub
parent c0422d7cc9
commit 6be1151ffc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -1596,8 +1596,11 @@ void NativeWindowMac::PreviewFile(const std::string& path,
}
void NativeWindowMac::CloseFilePreview() {
if ([QLPreviewPanel sharedPreviewPanelExists]) {
// Need to be careful about checking [QLPreviewPanel sharedPreviewPanel] as
// simply accessing it will cause it to reinitialize and reappear.
if ([QLPreviewPanel sharedPreviewPanelExists] && preview_item_) {
[[QLPreviewPanel sharedPreviewPanel] close];
preview_item_ = nil;
}
}