[gnome-shell] Fix JSObject leak in workspace.js



commit 46bce04788c29a48d0ca070f651035e225b3625c
Author: Maxim Ermilov <zaspire rambler ru>
Date:   Thu Mar 18 01:23:32 2010 +0300

    Fix JSObject leak in workspace.js
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612318

 js/ui/dnd.js       |    4 ++++
 js/ui/workspace.js |   13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 4ce2a0b..bfd3010 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -37,6 +37,10 @@ _Draggable.prototype = {
         if (!manualMode)
             this.actor.connect('button-press-event',
                                Lang.bind(this, this._onButtonPress));
+
+        this.actor.connect('destroy', Lang.bind(this, function() {
+            this.disconnectAll();
+        }));
         this._onEventId = null;
 
         this._buttonDown = false; // The mouse button has been pressed and has not yet been released.
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 0b55990..522c251 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -199,8 +199,12 @@ WindowClone.prototype = {
     },
 
     _onDestroy: function() {
+        this.metaWindow._delegate = null;
+        this.actor._delegate = null;
         if (this._zoomLightbox)
             this._zoomLightbox.destroy();
+
+        this.disconnectAll();
     },
 
     _onEnter: function (actor, event) {
@@ -1370,8 +1374,8 @@ Workspace.prototype = {
             Mainloop.source_remove(this._repositionWindowsId);
             this._repositionWindowsId = 0;
         }
-        Main.overview.connect('hidden', Lang.bind(this,
-                                                  this._doneLeavingOverview));
+        this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
+                                                                           this._doneLeavingOverview));
 
         // Position and scale the windows.
         for (let i = 1; i < this._windows.length; i++) {
@@ -1479,6 +1483,10 @@ Workspace.prototype = {
     },
 
     _onDestroy: function(actor) {
+        if (this._overviewHiddenId) {
+            Main.overview.disconnect(this._overviewHiddenId);
+            this._overviewHiddenId = 0;
+        }
         Tweener.removeTweens(actor);
 
         this._metaWorkspace.disconnect(this._windowAddedId);
@@ -1493,6 +1501,7 @@ Workspace.prototype = {
         // the desktop window, which is never reparented
         for (let w = 1; w < this._windows.length; w++)
             this._windows[w].destroy();
+        this._windows = [];
     },
 
     // Sets this.leavingOverview flag to false.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]