From b7173a41fd6b1c0dd997515e972f6667755c68a4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 4 Oct 2010 11:55:42 -0400 Subject: [PATCH] Dispose of Actor objects properly. --- web_frontend/actor.js | 18 ++++++++++++++++-- web_frontend/version.js | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/web_frontend/actor.js b/web_frontend/actor.js index 3e47d0c..a6b1daf 100644 --- a/web_frontend/actor.js +++ b/web_frontend/actor.js @@ -45,6 +45,8 @@ armadillo.Actor = function(file) { * @type {goog.ui.Popup} */ this.popup_ = new goog.ui.Popup(this.element_); + goog.events.listenOnce(this.popup_, goog.ui.PopupBase.EventType.HIDE, + this.onPopupClosed_, false, this); /** * The UI element used for a specific action. @@ -101,7 +103,7 @@ armadillo.Actor.prototype.disposeInternal = function() { armadillo.Actor.superClass_.disposeInternal.call(this); // Unlisten the tiles. - var tiles = goog.dom.getElementsByClassName('tile', this.element_); + var tiles = goog.dom.getElementsByClass('tile', this.element_); goog.array.forEach(tiles, function (tile) { goog.events.unlistenByKey(tile.actorListener); }); @@ -223,7 +225,7 @@ armadillo.Actor.prototype.performMove_ = function() { */ armadillo.Actor.prototype.performDelete_ = function() { this.actionObject_ = this.createActionDialog_(); - confirm.setTitle('Confirm Delete'); + this.actionObject_.setTitle('Confirm Delete'); var container = this.actionObject_.getContentElement(); var content = goog.dom.createDom('span', null, @@ -259,3 +261,15 @@ armadillo.Actor.prototype.createActionDialog_ = function() { confirm.setHasTitleCloseButton(false); return confirm; }; + +/** + * Event handler for when this.popup_ closes. + * @param {Event} e + */ +armadillo.Actor.prototype.onPopupClosed_ = function(e) { + // If an action is not being performed, then dispose the Actor. Otherwise, + // this will get cleaned up after the actionObject_ closes. + if (!this.actionObject_) { + this.dispose(); + } +}; diff --git a/web_frontend/version.js b/web_frontend/version.js index 8d55bb7..b1eed0e 100644 --- a/web_frontend/version.js +++ b/web_frontend/version.js @@ -11,5 +11,5 @@ goog.provide('armadillo.Version'); armadillo.Version.MAJOR = 0; armadillo.Version.MINOR = 2; -armadillo.Version.BUILD = 162; -armadillo.Version.STAMP = 1286199444; +armadillo.Version.BUILD = 193; +armadillo.Version.STAMP = 1286207707; -- 2.22.5