Guard against undefined, fix #2995
In theory this should never happen, seems like some object is garbage collected after the JavaScript context has been destroyed.
This commit is contained in:
parent
c916baa939
commit
927c3f34c3
1 changed files with 2 additions and 0 deletions
|
@ -34,6 +34,7 @@ class ObjectsRegistry extends EventEmitter
|
||||||
@dereference id, 1
|
@dereference id, 1
|
||||||
# Also reduce the count in owner.
|
# Also reduce the count in owner.
|
||||||
pointer = @owners[webContentsId]
|
pointer = @owners[webContentsId]
|
||||||
|
return unless pointer?
|
||||||
--pointer[id]
|
--pointer[id]
|
||||||
delete pointer[id] if pointer[id] is 0
|
delete pointer[id] if pointer[id] is 0
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ class ObjectsRegistry extends EventEmitter
|
||||||
# Private: Dereference the object from store.
|
# Private: Dereference the object from store.
|
||||||
dereference: (id, count) ->
|
dereference: (id, count) ->
|
||||||
pointer = @storage[id]
|
pointer = @storage[id]
|
||||||
|
return unless pointer?
|
||||||
pointer.count -= count
|
pointer.count -= count
|
||||||
if pointer.count is 0
|
if pointer.count is 0
|
||||||
v8Util.deleteHiddenValue pointer.object, 'atomId'
|
v8Util.deleteHiddenValue pointer.object, 'atomId'
|
||||||
|
|
Loading…
Reference in a new issue