Revision: 3911
          http://vexi.svn.sourceforge.net/vexi/?rev=3911&view=rev
Author:   clrg
Date:     2010-10-12 20:22:15 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
Fix leak in tooltipmanager caused by consecutively activated tooltips (tooltips 
activated in isolation would not have leaked)

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/tooltipmanager.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/tooltipmanager.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/tooltipmanager.t       
2010-10-08 14:55:31 UTC (rev 3910)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/tooltipmanager.t       
2010-10-12 20:22:15 UTC (rev 3911)
@@ -20,18 +20,25 @@
         surface.tooltip ++= .util.common..readOnly;
         
         /** drop tooltip with mouse interaction */
-        var pressWrite = function(v) { model.dropRequest(curTipReq); return; }
+        var pressWrite = function(v) {
+            model.dropRequest(curTipReq);
+            return;
+        }
         
         /** popdown tooltip if it's parent widget is undisplayed */
         var surfaceWrite = function(v) {
-             cascade = v;
-             if (!trapee.surface) model.dropRequest(trapee);
+            cascade = v;
+            if (!trapee.surface) {
+                model.dropRequest(trapee);
+            }
         }
         
         /** popdown tooltip if it's parent widget is undisplayed */
         var visibleWrite = function(v) {
             cascade = v;
-            if (!v) model.dropRequest(trapee);
+            if (!v) {
+                model.dropRequest(trapee);
+            }
         }
         
         /** tooltip display thread function */
@@ -43,8 +50,9 @@
             } while (newTipReq);
             
             // popup or move on
-            if (curTipReq and curTipReq.visible and curTipReq.surface) 
+            if (curTipReq and curTipReq.visible and curTipReq.surface) {
                 popup = true;
+            }
             recTipReq = false;
             tip = false;
             return;
@@ -52,7 +60,9 @@
         
         /** set tooltip contents and position on popup request */
         thisbox.popup ++= function(v) {
-            if (!curTipReq) return true;
+            if (!curTipReq) {
+                return true;
+            }
             // set up tooltip popbox
             var s = surface;
             var d = s.frame.distanceto(curTipReq);
@@ -67,7 +77,9 @@
         
         /** clean up on popdown */
         thisbox.popdown ++= function(v) {
-            if (!curTipReq) return true;
+            if (!curTipReq) {
+                return true;
+            }
             curTipReq.v_active_tooltip = false;
             curTipReq.surface --= surfaceWrite;
             curTipReq.visible --= visibleWrite;
@@ -77,23 +89,29 @@
         
         /** make v the tooltip requesting display */
         model.makeRequest = function(v) {
-            // clean up previous tooltip
-            if (curTipReq) curTipReq.v_active_tooltip = false;
+            if (curTipReq) {
+                // clean up previous tooltip
+                curTipReq.v_active_tooltip = false;
+                curTipReq.surface --= surfaceWrite;
+                curTipReq.visible --= visibleWrite;
+            }
             // register new tooltip request
             v.v_active_tooltip = true;
             curTipReq = v;
             newTipReq = true;
-            // already showing previous tooltip
             if (recTipReq or popped) {
+                // already showing previous tooltip
                 var t = curTipReq.tooltip;
                 if (typeof(t) == "box") {
                     $tooltip.text = "";
                     $tooltip[0] = t;
-                } else $tooltip.text = t;
+                } else {
+                    $tooltip.text = t;
+                }
                 popup = true;
             
-            // if thread is not already in progress, start it
             } else if (!tip) {
+                // if thread is not already in progress, start it
                 tip = true;
                 vexi.thread = popTooltipThread;
             }
@@ -101,13 +119,17 @@
         
         /** drop the tooltip request if it is the current request */
         model.dropRequest = function(v) {
-            if (curTipReq != v) return;
+            if (curTipReq != v) {
+                return;
+            }
             if (popped) {
                 recTipReq = true;
                 popdown = true;
                 curTipReq = null;
                 vexi.thread = popTooltipThread;
-            } else curTipReq = null;
+            } else {
+                curTipReq = null;
+            }
         }
         
     </ui:box>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to