Merge pull request #9314 from electron/fix-windowopen-memory-leak

Fix context leak in ObjectLifeMonitor.
This commit is contained in:
Cheng Zhao 2017-05-01 15:49:13 +09:00 committed by GitHub
commit ca7ca3ba1c
2 changed files with 1 additions and 3 deletions

View file

@ -12,8 +12,7 @@ namespace atom {
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
v8::Local<v8::Object> target)
: context_(isolate, isolate->GetCurrentContext()),
target_(isolate, target),
: target_(isolate, target),
weak_ptr_factory_(this) {
target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter);
}

View file

@ -22,7 +22,6 @@ class ObjectLifeMonitor {
static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
v8::Global<v8::Context> context_;
v8::Global<v8::Object> target_;
base::WeakPtrFactory<ObjectLifeMonitor> weak_ptr_factory_;