fix: memory leak in BrowserWindow (#27621)
This commit is contained in:
parent
b6a91ef5df
commit
e87803919b
4 changed files with 3 additions and 33 deletions
|
@ -35,9 +35,6 @@ TrackableObjectBase::TrackableObjectBase() {
|
|||
// TODO(zcbenz): Make TrackedObject work in renderer process.
|
||||
DCHECK(gin_helper::Locker::IsBrowserProcess())
|
||||
<< "This class only works for browser process";
|
||||
|
||||
electron::ElectronBrowserMainParts::Get()->RegisterDestructionCallback(
|
||||
GetDestroyClosure());
|
||||
}
|
||||
|
||||
TrackableObjectBase::~TrackableObjectBase() = default;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "base/bind.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
|
||||
#include "shell/common/gin_helper/event_emitter.h"
|
||||
#include "shell/common/key_weak_map.h"
|
||||
|
||||
|
@ -19,7 +20,7 @@ class SupportsUserData;
|
|||
namespace gin_helper {
|
||||
|
||||
// Users should use TrackableObject instead.
|
||||
class TrackableObjectBase {
|
||||
class TrackableObjectBase : public CleanedUpAtExit {
|
||||
public:
|
||||
TrackableObjectBase();
|
||||
|
||||
|
@ -33,7 +34,7 @@ class TrackableObjectBase {
|
|||
static int32_t GetIDFromWrappedClass(base::SupportsUserData* wrapped);
|
||||
|
||||
protected:
|
||||
virtual ~TrackableObjectBase();
|
||||
~TrackableObjectBase() override;
|
||||
|
||||
// Returns a closure that can destroy the native class.
|
||||
base::OnceClosure GetDestroyClosure();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue