Ubuntu Pastebin

Paste from Marco Trevisan (3v1n0) at Fri, 20 Oct 2017 07:39:42 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/windowPreview.js b/windowPreview.js
index 80b65d7..794650f 100644
--- a/windowPreview.js
+++ b/windowPreview.js
@@ -463,7 +463,7 @@ const thumbnailPreview = new Lang.Class({
         let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
         if(!scaleFactor)
             scaleFactor = 1;
-        
+
         this._thumbnailWidth = DEFAULT_THUMBNAIL_WIDTH*scaleFactor;
         this._thumbnailHeight = DEFAULT_THUMBNAIL_HEIGHT*scaleFactor;
 
@@ -502,9 +502,9 @@ const thumbnailPreview = new Lang.Class({
                                   });
         this._titleBin.add_style_class_name("preview-window-title");
 
-        this.window.connect('notify::title', Lang.bind(this, function() {
-                            this._title.set_text(this.window.title);
-                            }));
+        this._titleNotifyId = this.window.connect('notify::title', Lang.bind(this, function() {
+                                                   this._title.set_text(this.window.title);
+                                               }));
 
         this._windowBin = new St.Bin({ child: this.overlayGroup,
                                     x_align: St.Align.MIDDLE,
@@ -530,6 +530,8 @@ const thumbnailPreview = new Lang.Class({
                                   Lang.bind(this, this._onLeave));
         this.actor.connect('motion-event',
                                   Lang.bind(this, this._onMotionEvent));
+        this.actor.connect('destroy',
+                                  Lang.bind(this, this._onDestroy));
     },
 
     _onEnter: function(actor, event) {
@@ -750,6 +752,11 @@ const thumbnailPreview = new Lang.Class({
                 }));
             }
         }
+    },
+
+    _onDestroy: function() {
+        this.window.disconnect(this._titleNotifyId);
+        this._titleNotifyId = 0;
     }
 });
 
Download as text