From 0d0a379cd8d5228077781cd99cf0f14d3af491c2 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 6 Jan 2016 15:17:58 +0000 Subject: [PATCH] VideoView: Fix a dispatcher leak Make sure we unregister from the dispatcher when the videoview goes away. --- src/components/views/voip/VideoView.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/views/voip/VideoView.js b/src/components/views/voip/VideoView.js index 0a95e0d0c8..5145f05954 100644 --- a/src/components/views/voip/VideoView.js +++ b/src/components/views/voip/VideoView.js @@ -25,8 +25,12 @@ var dis = require('../../../dispatcher'); module.exports = React.createClass({ displayName: 'VideoView', - componentWillMount: function() { - dis.register(this.onAction); + componentDidMount: function() { + this.dispatcherRef = dis.register(this.onAction); + }, + + componentWillUnmount: function() { + dis.unregister(this.dispatcherRef); }, getRemoteVideoElement: function() {