Erase window from weak map immediately after it's destroyed.
Otherwise it could happend that developers accessed the window after it's destroyed but before it's GCed.
This commit is contained in:
parent
ca1b8ada99
commit
d19e62d867
1 changed files with 4 additions and 1 deletions
|
@ -55,7 +55,10 @@ process.on 'ATOM_BROWSER_INTERNAL_NEW', (obj) ->
|
|||
objectsWeakMap.add obj
|
||||
|
||||
# Also remember all windows.
|
||||
windowsWeakMap.add obj if obj.constructor is BrowserWindow
|
||||
if obj.constructor is BrowserWindow
|
||||
id = windowsWeakMap.add obj
|
||||
obj.on 'destroyed', ->
|
||||
windowsWeakMap.remove id
|
||||
|
||||
exports.add = (processId, routingId, obj) ->
|
||||
# Some native objects may already been added to objectsWeakMap, be care not
|
||||
|
|
Loading…
Add table
Reference in a new issue