fix: crash in gin::wrappable::secondweakcallback (#45368)
This commit is contained in:
parent
8cf2e46c1f
commit
ecd5d0a3a4
19 changed files with 233 additions and 6 deletions
|
@ -236,6 +236,10 @@ const char* Notification::GetTypeName() {
|
|||
return GetClassName();
|
||||
}
|
||||
|
||||
void Notification::WillBeDestroyed() {
|
||||
ClearWeak();
|
||||
}
|
||||
|
||||
} // namespace electron::api
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -57,6 +57,9 @@ class Notification final : public gin::Wrappable<Notification>,
|
|||
static gin::WrapperInfo kWrapperInfo;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
// gin_helper::CleanedUpAtExit
|
||||
void WillBeDestroyed() override;
|
||||
|
||||
// disable copy
|
||||
Notification(const Notification&) = delete;
|
||||
Notification& operator=(const Notification&) = delete;
|
||||
|
|
|
@ -1909,6 +1909,10 @@ const char* Session::GetTypeName() {
|
|||
return GetClassName();
|
||||
}
|
||||
|
||||
void Session::WillBeDestroyed() {
|
||||
ClearWeak();
|
||||
}
|
||||
|
||||
} // namespace electron::api
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -103,6 +103,9 @@ class Session final : public gin::Wrappable<Session>,
|
|||
static const char* GetClassName() { return "Session"; }
|
||||
const char* GetTypeName() override;
|
||||
|
||||
// gin_helper::CleanedUpAtExit
|
||||
void WillBeDestroyed() override;
|
||||
|
||||
// Methods.
|
||||
v8::Local<v8::Promise> ResolveHost(
|
||||
std::string host,
|
||||
|
|
|
@ -431,6 +431,10 @@ const char* Tray::GetTypeName() {
|
|||
return GetClassName();
|
||||
}
|
||||
|
||||
void Tray::WillBeDestroyed() {
|
||||
ClearWeak();
|
||||
}
|
||||
|
||||
} // namespace electron::api
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -58,6 +58,9 @@ class Tray final : public gin::Wrappable<Tray>,
|
|||
static gin::WrapperInfo kWrapperInfo;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
// gin_helper::CleanedUpAtExit
|
||||
void WillBeDestroyed() override;
|
||||
|
||||
// disable copy
|
||||
Tray(const Tray&) = delete;
|
||||
Tray& operator=(const Tray&) = delete;
|
||||
|
|
|
@ -4569,6 +4569,10 @@ const char* WebContents::GetTypeName() {
|
|||
return GetClassName();
|
||||
}
|
||||
|
||||
void WebContents::WillBeDestroyed() {
|
||||
ClearWeak();
|
||||
}
|
||||
|
||||
ElectronBrowserContext* WebContents::GetBrowserContext() const {
|
||||
return static_cast<ElectronBrowserContext*>(
|
||||
web_contents()->GetBrowserContext());
|
||||
|
|
|
@ -180,6 +180,9 @@ class WebContents final : public ExclusiveAccessContext,
|
|||
static gin::WrapperInfo kWrapperInfo;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
// gin_helper::CleanedUpAtExit
|
||||
void WillBeDestroyed() override;
|
||||
|
||||
void Destroy();
|
||||
void Close(std::optional<gin_helper::Dictionary> options);
|
||||
base::WeakPtr<WebContents> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
|
||||
|
|
|
@ -306,6 +306,10 @@ const char* MessagePort::GetTypeName() {
|
|||
return "MessagePort";
|
||||
}
|
||||
|
||||
void MessagePort::WillBeDestroyed() {
|
||||
ClearWeak();
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -61,6 +61,9 @@ class MessagePort final : public gin::Wrappable<MessagePort>,
|
|||
v8::Isolate* isolate) override;
|
||||
const char* GetTypeName() override;
|
||||
|
||||
// gin_helper::CleanedUpAtExit
|
||||
void WillBeDestroyed() override;
|
||||
|
||||
private:
|
||||
MessagePort();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue