File gnome-shell-933768-fix-leaked-signals-in-login-screen.patch of Package gnome-shell.1083
From 16b5e2f304fa93915dd63bb625013ac17cbde90d Mon Sep 17 00:00:00 2001
From: Felix Zhang <fezhang@suse.com>
Date: Fri, 10 Jul 2015 11:53:22 +0800
Subject: [PATCH] bnc#933768: fix leaked signals in login screen
The leaked signals causes the login screen locks after 3 failed
verifications, and potentially other issues.
Backported from the following upstream commits:
8d3ff56846163e9ce9391bbe9f1f09a06a6baac7
d8d046f2b3ed3d9ec3d46ac17cb185838dae8a28
6a969b934ff36df8133f6ab7ac97ff6bc48ac702
upstream bug: https://bugzilla.gnome.org/show_bug.cgi?id=738256
---
js/gdm/authPrompt.js | 9 ++++---
js/gdm/loginDialog.js | 73 +++++++++++++++++++++++++++++++++++----------------
js/gdm/util.js | 44 ++++++++++++++++++++++---------
3 files changed, 88 insertions(+), 38 deletions(-)
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 4b4aaf5..1015578 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -136,8 +136,7 @@ const AuthPrompt = new Lang.Class({
},
_onDestroy: function() {
- this._userVerifier.clear();
- this._userVerifier.disconnectAll();
+ this._userVerifier.destroy();
this._userVerifier = null;
},
@@ -422,11 +421,13 @@ const AuthPrompt = new Lang.Class({
},
setUser: function(user) {
+ let oldChild = this._userWell.get_child();
+ if (oldChild)
+ oldChild.destroy();
+
if (user) {
let userWidget = new UserWidget.UserWidget(user);
this._userWell.set_child(userWidget.actor);
- } else {
- this._userWell.set_child(null);
}
},
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 30effb8..ae16214 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -68,6 +68,8 @@ const UserListItem = new Lang.Class({
reactive: true,
x_align: St.Align.START,
x_fill: true });
+ this.actor.connect('destroy',
+ Lang.bind(this, this._onDestroy));
this._userAvatar = new UserWidget.Avatar(this.user,
{ styleClass: 'login-dialog-user-list-item-icon' });
@@ -112,6 +114,10 @@ const UserListItem = new Lang.Class({
this.actor.remove_style_pseudo_class('logged-in');
},
+ _onDestroy: function() {
+ this._user.disconnect(this._userChangedId);
+ },
+
_onClicked: function() {
this.emit('activate');
},
@@ -408,13 +414,12 @@ const LoginDialog = new Lang.Class({
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
this._greeter = gdmClient.get_greeter_sync(null);
- this._greeter.connect('default-session-name-changed',
- Lang.bind(this, this._onDefaultSessionChanged));
-
- this._greeter.connect('session-opened',
- Lang.bind(this, this._onSessionOpened));
- this._greeter.connect('timed-login-requested',
- Lang.bind(this, this._onTimedLoginRequested));
+ this._defaultSessionChangedId = this._greeter.connect('default-session-name-changed',
+ Lang.bind(this, this._onDefaultSessionChanged));
+ this._sessionOpenedId = this._greeter.connect('session-opened',
+ Lang.bind(this, this._onSessionOpened));
+ this._timedLoginRequestedId = this._greeter.connect('timed-login-requested',
+ Lang.bind(this, this._onTimedLoginRequested));
}
this._settings = new Gio.Settings({ schema: GdmUtil.LOGIN_SCREEN_SCHEMA });
@@ -429,8 +434,8 @@ const LoginDialog = new Lang.Class({
Lang.bind(this, this._updateLogo));
this._textureCache = St.TextureCache.get_default();
- this._textureCache.connect('texture-file-changed',
- Lang.bind(this, this._updateLogoTexture));
+ this._updateLogoTextureId = this._textureCache.connect('texture-file-changed',
+ Lang.bind(this, this._updateLogoTexture));
this._userSelectionBox = new St.BoxLayout({ style_class: 'login-dialog-user-selection-box',
x_align: Clutter.ActorAlign.CENTER,
@@ -543,8 +548,8 @@ const LoginDialog = new Lang.Class({
// If the user list is enabled, it should take key focus; make sure the
// screen shield is initialized first to prevent it from stealing the
// focus later
- Main.layoutManager.connect('startup-complete',
- Lang.bind(this, this._updateDisableUserList));
+ this._startupCompleteId = Main.layoutManager.connect('startup-complete',
+ Lang.bind(this, this._updateDisableUserList));
Main.screenShield.connect('active-changed',
Lang.bind(this, this._screenShieldActive));
@@ -981,6 +986,30 @@ const LoginDialog = new Lang.Class({
this._realmSignalId = 0;
this._realmManager.release();
}
+ if (this._userAddedId) {
+ this._userManager.disconnect(this._userAddedId);
+ this._userAddedId = 0;
+ }
+ if (this._userRemovedId) {
+ this._userManager.disconnect(this._userRemovedId);
+ this._userRemovedId = 0;
+ }
+ this._textureCache.disconnect(this._updateLogoTextureId);
+ Main.layoutManager.disconnect(this._startupCompleteId);
+ if (this._settings) {
+ this._settings.run_dispose();
+ this._settings = null;
+ }
+ if (this._greeter) {
+ this._greeter.disconnect(this._defaultSessionChangedId);
+ this._greeter.disconnect(this._sessionOpenedId);
+ this._greeter.disconnect(this._timedLoginRequestedId);
+ this._greeter = null;
+ }
+ if (this._greeterSessionProxy) {
+ this._greeterSessionProxy.disconnect(this._greeterSessionProxyChangedId);
+ this._greeterSessionProxy = null;
+ }
},
_loadUserList: function() {
@@ -996,17 +1025,17 @@ const LoginDialog = new Lang.Class({
}
this._updateDisableUserList();
- this._userManager.connect('user-added',
- Lang.bind(this, function(userManager, user) {
- this._userList.addUser(user);
- this._updateDisableUserList();
- }));
-
- this._userManager.connect('user-removed',
- Lang.bind(this, function(userManager, user) {
- this._userList.removeUser(user);
- this._updateDisableUserList();
- }));
+ this._userAddedId = this._userManager.connect('user-added',
+ Lang.bind(this, function(userManager, user) {
+ this._userList.addUser(user);
+ this._updateDisableUserList();
+ }));
+
+ this._userRemovedId = this._userManager.connect('user-removed',
+ Lang.bind(this, function(userManager, user) {
+ this._userList.removeUser(user);
+ this._updateDisableUserList();
+ }));
return GLib.SOURCE_REMOVE;
},
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 66852fd..8c18960 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -142,10 +142,10 @@ const ShellUserVerifier = new Lang.Class({
// after a user has been picked.
this._checkForSmartcard();
- this._smartcardManager.connect('smartcard-inserted',
- Lang.bind(this, this._checkForSmartcard));
- this._smartcardManager.connect('smartcard-removed',
- Lang.bind(this, this._checkForSmartcard));
+ this._smartcardInsertedId = this._smartcardManager.connect('smartcard-inserted',
+ Lang.bind(this, this._checkForSmartcard));
+ this._smartcardRemovedId = this._smartcardManager.connect('smartcard-removed',
+ Lang.bind(this, this._checkForSmartcard));
this._messageQueue = [];
this._messageQueueTimeoutId = 0;
@@ -159,8 +159,8 @@ const ShellUserVerifier = new Lang.Class({
if (this._oVirtCredentialsManager.hasToken())
this._oVirtUserAuthenticated(this._oVirtCredentialsManager.getToken());
- this._oVirtCredentialsManager.connect('user-authenticated',
- Lang.bind(this, this._oVirtUserAuthenticated));
+ this._oVirtUserAuthenticatedId = this._oVirtCredentialsManager.connect('user-authenticated',
+ Lang.bind(this, this._oVirtUserAuthenticated));
},
begin: function(userName, hold) {
@@ -191,20 +191,37 @@ const ShellUserVerifier = new Lang.Class({
}
},
+ _clearUserVerifier: function() {
+ if (this._userVerifier) {
+ this._userVerifier.run_dispose();
+ this._userVerifier = null;
+ }
+ },
+
clear: function() {
if (this._cancellable) {
this._cancellable.cancel();
this._cancellable = null;
}
- if (this._userVerifier) {
- this._userVerifier.run_dispose();
- this._userVerifier = null;
- }
-
+ this._clearUserVerifier();
this._clearMessageQueue();
},
+ destroy: function() {
+ this.clear();
+
+ this._settings.run_dispose();
+ this._settings = null;
+
+ this._smartcardManager.disconnect(this._smartcardInsertedId);
+ this._smartcardManager.disconnect(this._smartcardRemovedId);
+ this._smartcardManager = null;
+
+ this._oVirtCredentialsManager.disconnect(this._oVirtUserAuthenticatedId);
+ this._oVirtCredentialsManager = null;
+ },
+
answerQuery: function(serviceName, answer) {
if (!this.hasPendingMessages) {
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
@@ -281,9 +298,10 @@ const ShellUserVerifier = new Lang.Class({
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable, Lang.bind(this,
function(device, error) {
- if (!error && device)
+ if (!error && device) {
this._haveFingerprintReader = true;
this._updateDefaultService();
+ }
}));
},
@@ -324,6 +342,7 @@ const ShellUserVerifier = new Lang.Class({
_reauthenticationChannelOpened: function(client, result) {
try {
+ this._clearUserVerifier();
this._userVerifier = client.open_reauthentication_channel_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
return;
@@ -347,6 +366,7 @@ const ShellUserVerifier = new Lang.Class({
_userVerifierGot: function(client, result) {
try {
+ this._clearUserVerifier();
this._userVerifier = client.get_user_verifier_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
return;
--
2.1.4