Fix context leak in ObjectLifeMonitor.

The RemoteObjectFreer class is keeping the context alive even when the window is
closed. For electron applications that use sandbox, this will cause a memory
leak every time a new window is created with `window.open`.

Close #9191
This commit is contained in:
Thiago de Arruda 2017-04-28 11:21:53 -03:00
parent 79b02ca71e
commit 19b6ba044b
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);
}