From 9e4ee2470726e3334eb47d904a6f4079d4ed7aef Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 17:01:39 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video then wait for a while Signed-off-by: Ananya Sen --- js/helper-classes/3D/draw-utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 02d946ae..63e7799a 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -112,6 +112,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.eventManager.addEventListener("elementDeleted", this, false); this.eventManager.addEventListener("deleteSelection", this, false); this.eventManager.addEventListener("elementChange", this, false); + this.eventManager.addEventListener("closeDocument", this, false); } }, @@ -135,6 +136,15 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { } }, + handleCloseDocument:{ + value: function() { + if(this.application.ninja.documentController._documents.length === 0){ + this._eltArray = []; + this._planesArray = []; + } + } + }, + handleElementAdded: { value: function(event) { this.addElement(event.detail); -- cgit v1.2.3 From 28e3a3cc8b4a2e37c29db2fa01c61c17d24de07a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 8 Mar 2012 13:54:11 -0800 Subject: null the arrays on all documents closed, so that they get garbage collected Signed-off-by: Ananya Sen --- js/helper-classes/3D/draw-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D/draw-utils.js') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 63e7799a..59da411f 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -139,8 +139,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { handleCloseDocument:{ value: function() { if(this.application.ninja.documentController._documents.length === 0){ - this._eltArray = []; - this._planesArray = []; + this._eltArray = null; + this._planesArray = null; } } }, -- cgit v1.2.3