[Laszlo-checkins] r12233 - openlaszlo/trunk/lps/components/utils/replicator

bargull@openlaszlo.org bargull at openlaszlo.org
Thu Dec 25 03:35:39 PST 2008


Author: bargull
Date: 2008-12-25 03:35:36 -0800 (Thu, 25 Dec 2008)
New Revision: 12233

Modified:
   openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx
   openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
Log:
Change 20081225-bargull-kYE by bargull at dell--p4--2-53 on 2008-12-25 12:32:09
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix nullptr exception in lz.replicator

New Features:

Bugs Fixed: LPP-7522

Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
"LzView#layouts" can be `null`, so you need to avoid to dereference the nullptr.
    

Tests:



Modified: openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx	2008-12-25 11:35:09 UTC (rev 12232)
+++ openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx	2008-12-25 11:35:36 UTC (rev 12233)
@@ -29,10 +29,10 @@
             // turned off before any views get instantiated, and stays off
             // all the time, it can only cause trouble.
             // 
-            var p = this.container;
-            if (p.layouts) {
-                for (var l=0, len=p.layouts.length; l<len; l++) {
-                    p.layouts[l].lock();
+            var layouts = this.container.layouts;
+            if (layouts) {
+                for (var i = 0, len = layouts.length; i < len; i++) {
+                    layouts[i].lock();
                 }
             }
 
@@ -267,10 +267,10 @@
 
         <method name="destroy">
             <![CDATA[ 
-            var p = this.container;
-            if (p.layouts) {
-                for (var l=0, len=p.layouts.length; l<len; l++) {
-                    p.layouts[l].unlock();
+            var layouts = this.container.layouts;
+            if (layouts) {
+                for (var i = 0, len = layouts.length; i < len; i++) {
+                    layouts[i].unlock();
                 }
             }
             super.destroy();

Modified: openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx	2008-12-25 11:35:09 UTC (rev 12232)
+++ openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx	2008-12-25 11:35:36 UTC (rev 12233)
@@ -238,25 +238,24 @@
         <!-- @keywords private -->
         <method name="__adjustVisibleClones" args="ignore=null" >
             <![CDATA[
-            var p = this.container;
-            var ll = p.layouts['length'];
-            if (ll) {
-                for (var l=0, len=ll; l<len; l++) {
-                    p.layouts[l].lock();
+            var layouts = this.container.layouts;
+            if (layouts) {
+                for (var i=0, len=layouts.length; i<len; i++) {
+                    layouts[i].lock();
                 }
             }
             while( this.clones.length ) this.poolClone( this.clones.pop() );
             if (this['nodes'] != null) {
-                var l = this.nodes.length;
-                for( var i = 0;i < l; i++ ){
-                    var cl = this.getClone( );
+                var len = this.nodes.length;
+                for (var i = 0; i < len; i++) {
+                    var cl = this.getClone();
                     this.bind( cl, i );
                     this.clones[ i ] = cl;
                 }
             }
-            if (ll) {
-                for (var l=0, len=ll; l<len; l++) {
-                    p.layouts[l].unlock();
+            if (layouts) {
+                for (var i=0, len=layouts.length; i<len; i++) {
+                    layouts[i].unlock();
                 }
             }
             ]]>
@@ -274,10 +273,10 @@
             @param LzDataNodeMixin datanode: The datanode of the clone to get -->
         <method name="getCloneForNode" args="datanode,dontmake = false">
             <![CDATA[
-            var l = this.clones.length; 
-            for ( var i = 0; i < l; i++ ){
-                if ( this.clones[ i ].datapath.p == datanode ){
-                    return this.clones[ i ];
+            var cls = this.clones;
+            for (var i = 0, len = cls.length; i < len; i++) {
+                if (cls[ i ].datapath.p == datanode) {
+                    return cls[ i ];
                 }
             }
             ]]>



More information about the Laszlo-checkins mailing list