diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-09-11 05:50:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 05:50:47 +0800 |
commit | 9b3b70433ea570d0c7a99034499fa9f86caf4d56 (patch) | |
tree | e78e6ce4cce48a9146e513de9b6da165c9a3c921 /app | |
parent | fdb023381be323bd3198d5e102447e6591e7e73e (diff) | |
parent | ee568d5f5a3d04f32969fd2ba3113b9eeb175d63 (diff) | |
download | tangerine-wallet-browser-9b3b70433ea570d0c7a99034499fa9f86caf4d56.tar.gz tangerine-wallet-browser-9b3b70433ea570d0c7a99034499fa9f86caf4d56.tar.zst tangerine-wallet-browser-9b3b70433ea570d0c7a99034499fa9f86caf4d56.zip |
Merge pull request #5228 from ConnorChristie/memory-leaks
Upgrade obs-store and fix memory leaks
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/metamask-controller.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 98cb62bfa..1060f508a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -177,7 +177,7 @@ module.exports = class MetamaskController extends EventEmitter { blockTracker: this.blockTracker, getGasPrice: this.getGasPrice.bind(this), }) - this.txController.on('newUnapprovedTx', opts.showUnapprovedTx.bind(opts)) + this.txController.on('newUnapprovedTx', () => opts.showUnapprovedTx()) this.txController.on(`tx:status-update`, (txId, status) => { if (status === 'confirmed' || status === 'failed') { @@ -1229,8 +1229,10 @@ module.exports = class MetamaskController extends EventEmitter { ) dnode.on('remote', (remote) => { // push updates to popup - const sendUpdate = remote.sendUpdate.bind(remote) + const sendUpdate = (update) => remote.sendUpdate(update) this.on('update', sendUpdate) + // remove update listener once the connection ends + dnode.on('end', () => this.removeListener('update', sendUpdate)) }) } @@ -1280,10 +1282,12 @@ module.exports = class MetamaskController extends EventEmitter { * @param {*} outStream - The stream to provide public config over. */ setupPublicConfig (outStream) { + const configStream = asStream(this.publicConfigStore) pump( - asStream(this.publicConfigStore), + configStream, outStream, (err) => { + configStream.destroy() if (err) log.error(err) } ) |