session: dont attach download dialog to deleted webContents window
This commit is contained in:
parent
0fa92923da
commit
46208b5b3e
2 changed files with 4 additions and 2 deletions
|
@ -315,7 +315,7 @@ void Session::OnDownloadCreated(content::DownloadManager* manager,
|
|||
bool prevent_default = Emit(
|
||||
"will-download",
|
||||
DownloadItem::Create(isolate(), item),
|
||||
api::WebContents::CreateFrom(isolate(), web_contents));
|
||||
web_contents);
|
||||
if (prevent_default) {
|
||||
item->Cancel(true);
|
||||
item->Remove();
|
||||
|
|
|
@ -70,7 +70,9 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
|
|||
return;
|
||||
|
||||
NativeWindow* window = nullptr;
|
||||
auto relay = NativeWindowRelay::FromWebContents(item->GetWebContents());
|
||||
content::WebContents* web_contents = item->GetWebContents();
|
||||
auto relay = web_contents ? NativeWindowRelay::FromWebContents(web_contents)
|
||||
: nullptr;
|
||||
if (relay)
|
||||
window = relay->window.get();
|
||||
|
||||
|
|
Loading…
Reference in a new issue