fix: win.closeFilePreview recreates panel when called twice (#45664)
* fix: close quick look during tests on macOS
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
* use longer delay 🤷
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
* fix: sharedPreviewPanel being recreated on close
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
* test: ensure preview panel gets closed
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
---------
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Maddock <smaddock@slack-corp.com>
This commit is contained in:
parent
3c6e75e22d
commit
bdab736f08
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6255,6 +6255,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
Reference in a new issue