windowPreview: disconnect from window title changes on actor destroy

When a popup is destroyed, the window might still emit signals of
title changed, causing crashes in gnome-shell

https://bugzilla.gnome.org/show_bug.cgi?id=788931
This commit is contained in:
Marco Trevisan (Treviño)
2017-10-20 01:01:18 -05:00
parent 96cd9bb387
commit 1dfcd3e4b9

View File

@@ -495,7 +495,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;
@@ -534,9 +534,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,
@@ -562,6 +562,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));
this._previewMenuPopupManager = new previewMenuPopupManager(window, this.actor);
},
@@ -815,6 +817,11 @@ const thumbnailPreview = new Lang.Class({
width: 0,
height: 0
});
},
_onDestroy: function() {
this.window.disconnect(this._titleNotifyId);
this._titleNotifyId = 0;
}
});
@@ -1142,4 +1149,4 @@ const previewMenuPopupManager = new Lang.Class({
window.disconnect(destroyId);
}));
}
});
});