[gnome-shell] PointerWatcher: keep a reference to the idle monitor



commit 56d76791f1570054fa5125d6b0b28c398d2521d2
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Jan 17 22:11:01 2013 +0100

    PointerWatcher: keep a reference to the idle monitor
    
    If nothing references the idle monitor, it can be finalized at GC,
    causing it to have no effect. Worse, if the finalization happens at
    wrong time, the pointer watcher can be permanently off, disabling the
    message tray.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691976

 js/ui/pointerWatcher.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/pointerWatcher.js b/js/ui/pointerWatcher.js
index 9f7f290..dc31a1d 100644
--- a/js/ui/pointerWatcher.js
+++ b/js/ui/pointerWatcher.js
@@ -41,10 +41,10 @@ const PointerWatcher = new Lang.Class({
     Name: 'PointerWatcher',
 
     _init: function() {
-        let idleMonitor = new GnomeDesktop.IdleMonitor();
-        idleMonitor.connect('became-active', Lang.bind(this, this._onIdleMonitorBecameActive));
-        idleMonitor.add_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
-        this._idle = idleMonitor.get_idletime() > IDLE_TIME;
+        this._idleMonitor = new GnomeDesktop.IdleMonitor();
+        this._idleMonitor.connect('became-active', Lang.bind(this, this._onIdleMonitorBecameActive));
+        this._idleMonitor.add_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
+        this._idle = this._idleMonitor.get_idletime() > IDLE_TIME;
         this._watches = [];
         this.pointerX = null;
         this.pointerY = null;



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