mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
fix: try clearing InspectableWebContents delegate earlier (#49406)
fix: try clearing InspectableWebContents delegate earlier
This commit is contained in:
@@ -1051,6 +1051,9 @@ void WebContents::InitWithWebContents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebContents::~WebContents() {
|
WebContents::~WebContents() {
|
||||||
|
if (inspectable_web_contents_)
|
||||||
|
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
|
||||||
|
|
||||||
if (owner_window_) {
|
if (owner_window_) {
|
||||||
owner_window_->RemoveBackgroundThrottlingSource(this);
|
owner_window_->RemoveBackgroundThrottlingSource(this);
|
||||||
}
|
}
|
||||||
@@ -1065,8 +1068,6 @@ WebContents::~WebContents() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
|
|
||||||
|
|
||||||
// This event is only for internal use, which is emitted when WebContents is
|
// This event is only for internal use, which is emitted when WebContents is
|
||||||
// being destroyed.
|
// being destroyed.
|
||||||
Emit("will-destroy");
|
Emit("will-destroy");
|
||||||
@@ -2202,8 +2203,8 @@ void WebContents::DevToolsOpened() {
|
|||||||
// Inherit owner window in devtools when it doesn't have one.
|
// Inherit owner window in devtools when it doesn't have one.
|
||||||
auto* devtools = inspectable_web_contents_->GetDevToolsWebContents();
|
auto* devtools = inspectable_web_contents_->GetDevToolsWebContents();
|
||||||
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
||||||
if (owner_window_ && !has_window) {
|
if (owner_window() && !has_window) {
|
||||||
DCHECK(!owner_window_.WasInvalidated());
|
CHECK(!owner_window_.WasInvalidated());
|
||||||
DCHECK_EQ(handle->owner_window(), nullptr);
|
DCHECK_EQ(handle->owner_window(), nullptr);
|
||||||
handle->SetOwnerWindow(devtools, owner_window());
|
handle->SetOwnerWindow(devtools, owner_window());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user