[Laszlo-checkins] r14296 - openlaszlo/trunk/WEB-INF/lps/lfc/helpers

ptw@openlaszlo.org ptw at openlaszlo.org
Thu Jul 9 08:50:11 PDT 2009


Author: ptw
Date: 2009-07-09 08:50:01 -0700 (Thu, 09 Jul 2009)
New Revision: 14296

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzCommand.lzs
Log:
Change 20090709-ptw-K by ptw at dueling-banjos.home on 2009-07-09 11:45:15 EDT
    in /Users/ptw/OpenLaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Clean up command on destroy

Bugs Fixed: LPP-8326 Command tag causes a memory leak

Technical Reviewer: max (pending)
QA Reviewer: Ammar.Tazami at corp.G.ho.st (pending)

Details:
    A command needs to remove itself from any keyboard shortcut when destroyed.

Tests:
    Test case from bug report



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzCommand.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzCommand.lzs	2009-07-09 15:49:10 UTC (rev 14295)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzCommand.lzs	2009-07-09 15:50:01 UTC (rev 14296)
@@ -53,10 +53,22 @@
 var keys = null;
 /** @access private */
 function $lzc$set_key(k) {
+    var oldKeys = this.keys;
+    if (oldKeys) {
+      lz.Keys.removeKeyComboCall(this, oldKeys);
+    }
     this.keys = k;
     lz.Keys.callOnKeyCombo( this , k );
 }
 
+override function destroy () {
+    var oldKeys = this.keys;
+    if (oldKeys) {
+      lz.Keys.removeKeyComboCall(this, oldKeys);
+    }
+    super.destroy();
+}
+
 /**
   * If the command is active, this event is sent
   * when the keys array are pressed simultaneously.



More information about the Laszlo-checkins mailing list