mirror of
https://github.com/electron/electron.git
synced 2026-01-11 00:18:02 -05:00
Check whether id is valid when adding to weak map.
It's possible that the object has been added to weak map before and then erased, so having an id property doesn't mean it's added in the weak map.
This commit is contained in:
@@ -59,7 +59,7 @@ process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) ->
|
||||
exports.add = (processId, routingId, obj) ->
|
||||
# Some native objects may already been added to objectsWeakMap, be care not
|
||||
# to add it twice.
|
||||
objectsWeakMap.add obj unless obj.id?
|
||||
objectsWeakMap.add obj unless obj.id? and objectsWeakMap.has obj.id
|
||||
|
||||
# Store and reference the object, then return the storeId which points to
|
||||
# where the object is stored. The caller can later dereference the object
|
||||
|
||||
Reference in New Issue
Block a user