[Laszlo-checkins] r9466 - in openlaszlo/trunk/WEB-INF/lps/lfc: kernel/dhtml views

max@openlaszlo.org max at openlaszlo.org
Wed Jun 4 23:25:21 PDT 2008


Author: max
Date: 2008-06-04 23:25:12 -0700 (Wed, 04 Jun 2008)
New Revision: 9466

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
Log:
Change 20080604-maxcarlson-x by maxcarlson at Roboto on 2008-06-04 21:11:58 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Prevent a sprite from being added to more than one parent

Bugs Fixed: LPP-5228 - LzView#addSubview: sprite can be added to several parent-sprites (DHTML)

Technical Reviewer: a.bargull at intensis.de
QA Reviewer: hminsky
Doc Reviewer: (pending)

Details: LzSprite.js - Test _parent to prevent a sprite from being added to a parent twice.

LaszloView.lzs - Move addedToParent test to top of method to prevent possible duplicate calls to sprites.
    
Tests: ant lztest, smoketest



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2008-06-05 04:23:41 UTC (rev 9465)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js	2008-06-05 06:25:12 UTC (rev 9466)
@@ -488,6 +488,7 @@
 LzSprite.prototype.__children = null;
 
 LzSprite.prototype.addChildSprite = function(sprite) {
+    if (sprite.__parent != null) return;
     //Debug.info('appendChild', sprite.__LZdiv);
     if ($debug) {
         if (this.stretches != null && this.__warnstretches != true) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2008-06-05 04:23:41 UTC (rev 9465)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2008-06-05 06:25:12 UTC (rev 9466)
@@ -473,16 +473,17 @@
   * @param LzView s: The new subview
   */
 function addSubview ( s ){
-      if (this.sprite) {
-          this.sprite.addChildSprite(s.sprite);
-      } else {
-          // TODO [hqm 2008-03] I put this in for a bug I was seeing
-          // swf9, need to see if it is still happening
-          Debug.warn("LzView.addSubview called when this.sprite is null", this);
-      }
-
     if ( s.addedToParent ) return;
 
+    if (this.sprite) {
+        this.sprite.addChildSprite(s.sprite);
+    } else {
+        // TODO [hqm 2008-03] I put this in for a bug I was seeing
+        // swf9, need to see if it is still happening
+        Debug.warn("LzView.addSubview called when this.sprite is null", this);
+    }
+
+
     // Don't use the prototype's default subviews array, it is a
     // sentinel which lives on the prototype and is shared by all
     // instances, make a new one if you want to push a view.



More information about the Laszlo-checkins mailing list