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:
parent
c0422d7cc9
commit
6be1151ffc
2 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6256,6 +6256,7 @@ describe('BrowserWindow module', () => {
|
|||
w.previewFile(__filename);
|
||||
await setTimeout(500);
|
||||
expect(showCalled).to.equal(false, 'should not have called show twice');
|
||||
w.closeFilePreview();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue