[gnome-shell/gnome-3-28] automountManager: remove allowAutorun expire timeout on volume removal



commit 65d27aaa438842bc9d730af1ec28b24345c60982
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Jul 4 14:55:28 2018 +0000

    automountManager: remove allowAutorun expire timeout on volume removal
    
    If the volume is removed before AUTORUN_EXPIRE_TIMEOUT_SECS seconds, we can stop
    the timeout earlier as there's nothing to unset, while the volume instance
    won't be valid anymore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791233
    
    
    (cherry picked from commit 9c41736a813354fd9291177b12f6c4f85bd1c5f7)

 js/ui/components/automountManager.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 2d8f3f8fb..a6cd85792 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -210,6 +210,10 @@ var AutomountManager = new Lang.Class({
     },
 
     _onVolumeRemoved(monitor, volume) {
+        if (volume._allowAutorunExpireId && volume._allowAutorunExpireId > 0) {
+            Mainloop.source_remove(volume._allowAutorunExpireId);
+            delete volume._allowAutorunExpireId;
+        }
         this._volumeQueue = 
             this._volumeQueue.filter(element => (element != volume));
     },
@@ -234,8 +238,10 @@ var AutomountManager = new Lang.Class({
     _allowAutorunExpire(volume) {
         let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
             volume.allowAutorun = false;
+            delete volume._allowAutorunExpireId;
             return GLib.SOURCE_REMOVE;
         });
+        volume._allowAutorunExpireId = id;
         GLib.Source.set_name_by_id(id, '[gnome-shell] volume.allowAutorun');
     }
 });


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