Tear down ipc response handler when atom environment is destroyed

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Katrina Uychaco
2016-07-07 15:53:07 -07:00
committed by Nathan Sobo
parent 438aac6244
commit 9bf329cef2

View File

@@ -224,11 +224,12 @@ class AtomEnvironment extends Model
@observeAutoHideMenuBar()
checkPortableHomeWritable = ->
checkPortableHomeWritable = =>
responseChannel = "check-portable-home-writable-response"
ipcRenderer.on responseChannel, (event, response) ->
ipcRenderer.removeAllListeners(responseChannel)
atom.notifications.addWarning("#{response.message.replace(/([\\\.+\\-_#!])/g, '\\$1')}") if not response.writable
@notifications.addWarning("#{response.message.replace(/([\\\.+\\-_#!])/g, '\\$1')}") if not response.writable
@disposables.add new Disposable => ipcRenderer.removeAllListeners(responseChannel)
ipcRenderer.send('check-portable-home-writable', responseChannel)
checkPortableHomeWritable()