...
 
Commits (3)
gdm3 (3.28.2-3) UNRELEASED; urgency=medium
* debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch:
- Keep the number of logged-in consistent with reality (LP: #1776487)
-- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 12 Jun 2018 18:58:45 +0200
gdm3 (3.28.2-2) unstable; urgency=medium
* debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch,
debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch,
debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch,
debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch,
debian/patches/libgdm-get-connection-explicitly.patch,
debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch,
debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch,
debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch,
debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch,
debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch,
debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch,
debian/patches/libgdm-Don-t-save-manager-address.patch,
debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch:
- Cherry picks commits from upstream 3.28 branch to propely fix ref-counting
issues on GdmClient (LP: #1766137)
-- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 05 Jun 2018 09:34:48 +0100
gdm3 (3.28.2-1) unstable; urgency=medium
* New upstream release 3.28.2
......
From: Jason Pleau <jason@jpleau.ca>
Date: Wed, 30 May 2018 21:48:22 -0400
Subject: daemon/gdm-session-record.c: open/close the utmp database
pututxline() was used without first opening the utxmp database and
without closing it, preventing the logout entry from being fully
committed.
This caused the number of logged-in users to increment after each login,
as logging out did not correctly remove the user login record from utmp.
This commit wraps pututxline() between setutxent() and endutxent(),
making sure that the login/logout operation are fully flushed.
Fixes #381
---
daemon/gdm-session-record.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c
index 487f100..d2df588 100644
--- a/daemon/gdm-session-record.c
+++ b/daemon/gdm-session-record.c
@@ -213,7 +213,9 @@ gdm_session_record_login (GPid session_pid,
/* Handle utmp */
#if defined(HAVE_GETUTXENT)
g_debug ("Adding or updating utmp record for login");
+ setutxent();
pututxline (&session_record);
+ endutxent();
#elif defined(HAVE_LOGIN)
login (&session_record);
#endif
@@ -256,7 +258,9 @@ gdm_session_record_logout (GPid session_pid,
/* Handle utmp */
#if defined(HAVE_GETUTXENT)
g_debug ("Adding or updating utmp record for logout");
+ setutxent();
pututxline (&session_record);
+ endutxent();
#elif defined(HAVE_LOGOUT)
logout (session_record.ut_line);
#endif
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Sat, 2 Jun 2018 19:34:08 +0200
Subject: libgdb: Try to reuse connections from the available proxies
Instead of using the hard-to-maintain shared pointer to the dbus connection
to the manager and reset it when the proxies that use it are deleted, just
look which proxy is currently available and try to reuse the connection
from it.
Fixes #386
---
libgdm/gdm-client.c | 70 +++++++++++++++++++++++++++++------------------------
1 file changed, 39 insertions(+), 31 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 7b42b6c..acf016a 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -46,7 +46,6 @@ struct GdmClientPrivate
GdmGreeter *greeter;
GdmRemoteGreeter *remote_greeter;
GdmChooser *chooser;
- GDBusConnection *connection;
char *address;
char **enabled_extensions;
@@ -71,6 +70,28 @@ gdm_client_error_quark (void)
return error_quark;
}
+static GDBusConnection *
+gdm_client_get_open_connection (GdmClient *client)
+{
+ GDBusProxy *proxy = NULL;
+
+ if (client->priv->user_verifier != NULL) {
+ proxy = G_DBUS_PROXY (client->priv->user_verifier);
+ } else if (client->priv->greeter != NULL) {
+ proxy = G_DBUS_PROXY (client->priv->greeter);
+ } else if (client->priv->remote_greeter != NULL) {
+ proxy = G_DBUS_PROXY (client->priv->remote_greeter);
+ } else if (client->priv->chooser != NULL) {
+ proxy = G_DBUS_PROXY (client->priv->chooser);
+ }
+
+ if (proxy != NULL) {
+ return g_dbus_proxy_get_connection (proxy);
+ }
+
+ return NULL;
+}
+
static void
on_got_manager (GObject *object,
GAsyncResult *result,
@@ -399,12 +420,15 @@ gdm_client_get_connection_sync (GdmClient *client,
GError **error)
{
g_autoptr(GdmManager) manager = NULL;
+ GDBusConnection *connection;
gboolean ret;
g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
- if (client->priv->connection != NULL) {
- return g_object_ref (client->priv->connection);
+ connection = gdm_client_get_open_connection (client);
+
+ if (connection != NULL) {
+ return g_object_ref (connection);
}
manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
@@ -429,23 +453,19 @@ gdm_client_get_connection_sync (GdmClient *client,
g_debug ("GdmClient: connecting to address: %s", client->priv->address);
- client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address,
- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
- NULL,
- cancellable,
- error);
+ connection = g_dbus_connection_new_for_address_sync (client->priv->address,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+ NULL,
+ cancellable,
+ error);
- if (client->priv->connection == NULL) {
+ if (connection == NULL) {
g_clear_pointer (&client->priv->address, g_free);
goto out;
}
- g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
- (gpointer *)
- &client->priv->connection);
-
out:
- return client->priv->connection;
+ return connection;
}
static void
@@ -545,12 +565,6 @@ gdm_client_get_connection_finish (GdmClient *client,
return NULL;
}
- if (client->priv->connection == NULL) {
- client->priv->connection = connection;
- g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
- (gpointer *) &client->priv->connection);
- }
-
return connection;
}
@@ -561,6 +575,7 @@ gdm_client_get_connection (GdmClient *client,
gpointer user_data)
{
GTask *task;
+ GDBusConnection *connection;
g_return_if_fail (GDM_IS_CLIENT (client));
@@ -569,9 +584,10 @@ gdm_client_get_connection (GdmClient *client,
callback,
user_data);
- if (client->priv->connection != NULL) {
+ connection = gdm_client_get_open_connection (client);
+ if (connection != NULL) {
g_task_return_pointer (task,
- g_object_ref (client->priv->connection),
+ g_object_ref (connection),
(GDestroyNotify) g_object_unref);
g_object_unref (task);
return;
@@ -775,7 +791,7 @@ gdm_client_get_user_verifier_sync (GdmClient *client,
if (strcmp (client->priv->enabled_extensions[i],
gdm_user_verifier_choice_list_interface_info ()->name) == 0) {
GdmUserVerifierChoiceList *choice_list_interface;
- choice_list_interface = gdm_user_verifier_choice_list_proxy_new_sync (client->priv->connection,
+ choice_list_interface = gdm_user_verifier_choice_list_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
SESSION_DBUS_PATH,
@@ -1509,14 +1525,6 @@ gdm_client_finalize (GObject *object)
&client->priv->chooser);
}
- if (client->priv->connection != NULL) {
- g_object_remove_weak_pointer (G_OBJECT (client->priv->connection),
- (gpointer *)
- &client->priv->connection);
- }
-
- g_clear_object (&client->priv->connection);
-
g_strfreev (client->priv->enabled_extensions);
g_free (client->priv->address);
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Fri, 1 Jun 2018 17:16:35 +0200
Subject: libgdm: Don't double-ref the connection got from task
Both if we re-use the shared connection in `gdm_client_get_connection` and if
we create a new one in `on_connected`, we steal the pointer here by using
`g_task_propagate_pointer` and thus we don't have to add an additional
reference to this connection when returning, or it won't ever be consumed by
function customers.
---
libgdm/gdm-client.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index fa4ba84..3629214 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -536,7 +536,7 @@ gdm_client_get_connection_finish (GdmClient *client,
GAsyncResult *result,
GError **error)
{
- GDBusConnection *connection = NULL;
+ GDBusConnection *connection;
g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
@@ -551,7 +551,7 @@ gdm_client_get_connection_finish (GdmClient *client,
(gpointer *) &client->priv->connection);
}
- return g_object_ref (connection);
+ return connection;
}
static void
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Fri, 1 Jun 2018 17:20:17 +0200
Subject: libgdm: Don't leak connection on sync re-authentication
---
libgdm/gdm-client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 3629214..335a040 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -604,7 +604,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
GCancellable *cancellable,
GError **error)
{
- GDBusConnection *connection;
+ g_autoptr(GDBusConnection) connection = NULL;
g_autoptr(GdmManager) manager = NULL;
GdmUserVerifier *user_verifier = NULL;
gboolean ret;
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Sat, 2 Jun 2018 19:44:24 +0200
Subject: libgdm: Don't save manager address
There's no need to keep the manager connection address around, and
use autofree to clean it up
---
libgdm/gdm-client.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index acf016a..0e8bf43 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -46,7 +46,6 @@ struct GdmClientPrivate
GdmGreeter *greeter;
GdmRemoteGreeter *remote_greeter;
GdmChooser *chooser;
- char *address;
char **enabled_extensions;
};
@@ -420,6 +419,7 @@ gdm_client_get_connection_sync (GdmClient *client,
GError **error)
{
g_autoptr(GdmManager) manager = NULL;
+ g_autofree char *address = NULL;
GDBusConnection *connection;
gboolean ret;
@@ -439,32 +439,26 @@ gdm_client_get_connection_sync (GdmClient *client,
error);
if (manager == NULL) {
- goto out;
+ return NULL;
}
ret = gdm_manager_call_open_session_sync (manager,
- &client->priv->address,
+ &address,
cancellable,
error);
if (!ret) {
- goto out;
+ return NULL;
}
- g_debug ("GdmClient: connecting to address: %s", client->priv->address);
+ g_debug ("GdmClient: connecting to address: %s", address);
- connection = g_dbus_connection_new_for_address_sync (client->priv->address,
+ connection = g_dbus_connection_new_for_address_sync (address,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
NULL,
cancellable,
error);
- if (connection == NULL) {
- g_clear_pointer (&client->priv->address, g_free);
- goto out;
- }
-
- out:
return connection;
}
@@ -497,6 +491,7 @@ on_session_opened (GdmManager *manager,
GTask *task)
{
GdmClient *client;
+ g_autofree char *address = NULL;
GCancellable *cancellable;
GError *error;
@@ -504,7 +499,7 @@ on_session_opened (GdmManager *manager,
error = NULL;
if (!gdm_manager_call_open_session_finish (manager,
- &client->priv->address,
+ &address,
result,
&error)) {
g_task_return_error (task, error);
@@ -514,7 +509,7 @@ on_session_opened (GdmManager *manager,
}
cancellable = g_task_get_cancellable (task);
- g_dbus_connection_new_for_address (client->priv->address,
+ g_dbus_connection_new_for_address (address,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
NULL,
cancellable,
@@ -1526,7 +1521,6 @@ gdm_client_finalize (GObject *object)
}
g_strfreev (client->priv->enabled_extensions);
- g_free (client->priv->address);
G_OBJECT_CLASS (gdm_client_parent_class)->finalize (object);
}
From: Iain Lane <iainl@gnome.org>
Date: Mon, 14 May 2018 22:32:25 +0200
Subject: libgdm: Drop weak refs on the GDBusConnection
The GDBusProxies hold a strong reference to the connection themselves,
so maintaining separate weak references is unnecessary.
This commit drops those extraneous weak references.
https://bugzilla.gnome.org/show_bug.cgi?id=795940
---
libgdm/gdm-client.c | 47 -----------------------------------------------
1 file changed, 47 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index e7b93e3..f327344 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -652,13 +652,6 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
cancellable,
error);
- if (user_verifier != NULL) {
- g_object_weak_ref (G_OBJECT (user_verifier),
- (GWeakNotify)
- g_object_unref,
- connection);
- }
-
out:
return user_verifier;
}
@@ -763,12 +756,6 @@ gdm_client_get_user_verifier_sync (GdmClient *client,
g_object_add_weak_pointer (G_OBJECT (client->priv->user_verifier),
(gpointer *)
&client->priv->user_verifier);
- g_object_ref (connection);
- g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
-
if (client->priv->enabled_extensions != NULL) {
gboolean res;
@@ -908,11 +895,6 @@ gdm_client_get_user_verifier_finish (GdmClient *client,
(gpointer *)
&client->priv->user_verifier);
- g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
-
return user_verifier;
}
@@ -1081,10 +1063,6 @@ gdm_client_get_greeter_finish (GdmClient *client,
(gpointer *)
&client->priv->greeter);
- g_object_weak_ref (G_OBJECT (client->priv->greeter),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
return greeter;
}
@@ -1129,10 +1107,6 @@ gdm_client_get_greeter_sync (GdmClient *client,
g_object_add_weak_pointer (G_OBJECT (client->priv->greeter),
(gpointer *)
&client->priv->greeter);
- g_object_weak_ref (G_OBJECT (client->priv->greeter),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
query_for_timed_login_requested_signal (client->priv->greeter);
}
@@ -1263,11 +1237,6 @@ gdm_client_get_remote_greeter_finish (GdmClient *client,
(gpointer *)
&client->priv->remote_greeter);
- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
-
return remote_greeter;
}
@@ -1311,11 +1280,6 @@ gdm_client_get_remote_greeter_sync (GdmClient *client,
g_object_add_weak_pointer (G_OBJECT (client->priv->remote_greeter),
(gpointer *)
&client->priv->remote_greeter);
- g_object_ref (connection);
- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
}
return client->priv->remote_greeter;
@@ -1444,12 +1408,6 @@ gdm_client_get_chooser_finish (GdmClient *client,
(gpointer *)
&client->priv->chooser);
- g_object_ref (connection);
- g_object_weak_ref (G_OBJECT (client->priv->chooser),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
-
return chooser;
}
@@ -1493,11 +1451,6 @@ gdm_client_get_chooser_sync (GdmClient *client,
g_object_add_weak_pointer (G_OBJECT (client->priv->chooser),
(gpointer *)
&client->priv->chooser);
- g_object_ref (connection);
- g_object_weak_ref (G_OBJECT (client->priv->chooser),
- (GWeakNotify)
- g_object_unref,
- client->priv->connection);
}
return client->priv->chooser;
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Mon, 4 Jun 2018 19:13:04 +0200
Subject: libgdm: Return NULL on invalid client instances
---
libgdm/gdm-client.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 0e8bf43..28cb725 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -423,7 +423,7 @@ gdm_client_get_connection_sync (GdmClient *client,
GDBusConnection *connection;
gboolean ret;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
connection = gdm_client_get_open_connection (client);
@@ -553,7 +553,7 @@ gdm_client_get_connection_finish (GdmClient *client,
{
GDBusConnection *connection;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
connection = g_task_propagate_pointer (G_TASK (result), error);
if (connection == NULL) {
@@ -621,7 +621,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
GdmUserVerifier *user_verifier = NULL;
gboolean ret;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
@@ -722,7 +722,7 @@ gdm_client_open_reauthentication_channel_finish (GdmClient *client,
GAsyncResult *result,
GError **error)
{
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
return g_task_propagate_pointer (G_TASK (result), error);
}
@@ -890,7 +890,7 @@ gdm_client_get_user_verifier_finish (GdmClient *client,
{
GdmUserVerifier *user_verifier;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
if (client->priv->user_verifier != NULL)
return g_object_ref (client->priv->user_verifier);
@@ -1058,7 +1058,7 @@ gdm_client_get_greeter_finish (GdmClient *client,
{
GdmGreeter *greeter;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
if (client->priv->greeter != NULL)
return g_object_ref (client->priv->greeter);
@@ -1232,7 +1232,7 @@ gdm_client_get_remote_greeter_finish (GdmClient *client,
{
GdmRemoteGreeter *remote_greeter;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
if (client->priv->remote_greeter != NULL)
return g_object_ref (client->priv->remote_greeter);
@@ -1403,7 +1403,7 @@ gdm_client_get_chooser_finish (GdmClient *client,
{
GdmChooser *chooser;
- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL);
if (client->priv->chooser != NULL)
return g_object_ref (client->priv->chooser);
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Fri, 1 Jun 2018 17:07:41 +0200
Subject: libgdm: Unref the manager propagated from task
This instance has already been reffed when passed to the task, and since
we're stealing it with `g_task_propagate_pointer` it won't be unreffed.
We could also do this in the `on_reauthentication_channel_opened` callback
but since the new task will ref it anyway, we can just be clean and do it
here.
---
libgdm/gdm-client.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index f327344..fa4ba84 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -390,7 +390,7 @@ on_got_manager_for_reauthentication (GdmClient *client,
(GAsyncReadyCallback)
on_reauthentication_channel_opened,
task);
-
+ g_object_unref (manager);
}
static GDBusConnection *
@@ -527,6 +527,8 @@ on_got_manager_for_opening_connection (GdmClient *client,
(GAsyncReadyCallback)
on_session_opened,
task);
+
+ g_object_unref (manager);
}
static GDBusConnection *
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Fri, 1 Jun 2018 17:22:20 +0200
Subject: libgdm: Use auto-pointers and cleanup code
---
libgdm/gdm-client.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 335a040..7b42b6c 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -606,9 +606,9 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
{
g_autoptr(GDBusConnection) connection = NULL;
g_autoptr(GdmManager) manager = NULL;
+ g_autofree char *address = NULL;
GdmUserVerifier *user_verifier = NULL;
gboolean ret;
- char *address;
g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
@@ -620,7 +620,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
error);
if (manager == NULL) {
- goto out;
+ return NULL;
}
ret = gdm_manager_call_open_reauthentication_channel_sync (manager,
@@ -630,10 +630,10 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
error);
if (!ret) {
- goto out;
+ return NULL;
}
- g_debug ("GdmClient: connecting to address: %s", client->priv->address);
+ g_debug ("GdmClient: connecting to address: %s", address);
connection = g_dbus_connection_new_for_address_sync (address,
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
@@ -642,10 +642,8 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
error);
if (connection == NULL) {
- g_free (address);
- goto out;
+ return NULL;
}
- g_free (address);
user_verifier = gdm_user_verifier_proxy_new_sync (connection,
G_DBUS_PROXY_FLAGS_NONE,
@@ -654,7 +652,6 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client,
cancellable,
error);
- out:
return user_verifier;
}
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 14 May 2018 14:48:31 -0400
Subject: libgdm: drop support for serializing multiple opens
Right now libgdm tries to handle multiple simultaneous
open calls at the same time by serializing the requests
and giving them all the same connection. It's broken,
though.
- The pending_opens list is never populated, so we
end up just doing multiple simultaneous open
operations at a time anyway.
- The finish code ends up calling
g_task_return_error (task, NULL) instead of
g_task_return_pointer in the non-error case.
Since the feature doesn't work, drop it for now.
https://bugzilla.gnome.org/show_bug.cgi?id=795940
---
libgdm/gdm-client.c | 111 +++++++++++++++++++---------------------------------
1 file changed, 40 insertions(+), 71 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index 294f4f4..a88a5d7 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -51,7 +51,6 @@ struct GdmClientPrivate
GDBusConnection *connection;
char *address;
- GList *pending_opens;
char **enabled_extensions;
};
@@ -421,53 +420,50 @@ gdm_client_open_connection_sync (GdmClient *client,
g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE);
- if (client->priv->manager == NULL) {
- client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.gnome.DisplayManager",
- "/org/gnome/DisplayManager/Manager",
- cancellable,
- error);
-
- if (client->priv->manager == NULL) {
- goto out;
- }
- } else {
- client->priv->manager = g_object_ref (client->priv->manager);
+ if (client->priv->connection != NULL) {
+ g_object_ref (client->priv->connection);
+ return TRUE;
}
- if (client->priv->connection == NULL) {
- ret = gdm_manager_call_open_session_sync (client->priv->manager,
- &client->priv->address,
- cancellable,
- error);
+ client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.gnome.DisplayManager",
+ "/org/gnome/DisplayManager/Manager",
+ cancellable,
+ error);
- if (!ret) {
- g_clear_object (&client->priv->manager);
- goto out;
- }
+ if (client->priv->manager == NULL) {
+ goto out;
+ }
+
+ ret = gdm_manager_call_open_session_sync (client->priv->manager,
+ &client->priv->address,
+ cancellable,
+ error);
- g_debug ("GdmClient: connecting to address: %s", client->priv->address);
+ if (!ret) {
+ g_clear_object (&client->priv->manager);
+ goto out;
+ }
- client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address,
- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
- NULL,
- cancellable,
- error);
+ g_debug ("GdmClient: connecting to address: %s", client->priv->address);
- if (client->priv->connection == NULL) {
- g_clear_object (&client->priv->manager);
- g_clear_pointer (&client->priv->address, g_free);
- goto out;
- }
+ client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+ NULL,
+ cancellable,
+ error);
- g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
- (gpointer *)
- &client->priv->connection);
- } else {
- client->priv->connection = g_object_ref (client->priv->connection);
+ if (client->priv->connection == NULL) {
+ g_clear_object (&client->priv->manager);
+ g_clear_pointer (&client->priv->address, g_free);
+ goto out;
}
+ g_object_add_weak_pointer (G_OBJECT (client->priv->connection),
+ (gpointer *)
+ &client->priv->connection);
+
out:
return client->priv->connection != NULL;
}
@@ -551,25 +547,6 @@ on_got_manager_for_opening_connection (GdmClient *client,
task);
}
-static void
-finish_pending_opens (GdmClient *client,
- GError *error)
-{
- GList *node;
-
- for (node = client->priv->pending_opens;
- node != NULL;
- node = node->next) {
-
- GTask *task = node->data;
-
- g_task_return_error (task, error);
- g_object_unref (task);
- }
- g_clear_pointer (&client->priv->pending_opens,
- (GDestroyNotify) g_list_free);
-}
-
static gboolean
gdm_client_open_connection_finish (GdmClient *client,
GAsyncResult *result,
@@ -581,7 +558,6 @@ gdm_client_open_connection_finish (GdmClient *client,
connection = g_task_propagate_pointer (G_TASK (result), error);
if (connection == NULL) {
- finish_pending_opens (client, *error);
return FALSE;
}
@@ -593,7 +569,6 @@ gdm_client_open_connection_finish (GdmClient *client,
connection = NULL;
}
- finish_pending_opens (client, NULL);
return TRUE;
}
@@ -620,17 +595,11 @@ gdm_client_open_connection (GdmClient *client,
return;
}
- if (client->priv->pending_opens == NULL) {
- get_manager (client,
- cancellable,
- (GAsyncReadyCallback)
- on_got_manager_for_opening_connection,
- task);
- } else {
- client->priv->pending_opens = g_list_prepend (client->priv->pending_opens,
- task);
- }
-
+ get_manager (client,
+ cancellable,
+ (GAsyncReadyCallback)
+ on_got_manager_for_opening_connection,
+ task);
}
/**
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 14 May 2018 15:49:50 -0400
Subject: libgdm: fix pointer/boolean task confusion
The manager fetching code in GdmClient treats its task
return value as boolean, but it's actually a pointer (the manager)
This commit corrects the confusion.
https://bugzilla.gnome.org/show_bug.cgi?id=795940
---
libgdm/gdm-client.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index a88a5d7..06dfe72 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -390,11 +390,13 @@ on_got_manager_for_reauthentication (GdmClient *client,
GTask *task)
{
GCancellable *cancellable;
+ GdmManager *manager;
char *username;
GError *error;
error = NULL;
- if (!g_task_propagate_boolean (G_TASK (result), &error)) {
+ manager = g_task_propagate_pointer (G_TASK (result), &error);
+ if (manager == NULL) {
g_task_return_error (task, error);
g_object_unref (task);
return;
@@ -530,10 +532,12 @@ on_got_manager_for_opening_connection (GdmClient *client,
GTask *task)
{
GCancellable *cancellable;
+ GdmManager *manager;
GError *error;
error = NULL;
- if (!g_task_propagate_boolean (G_TASK (result), &error)) {
+ manager = g_task_propagate_pointer (G_TASK (result), &error);
+ if (manager == NULL) {
g_task_return_error (task, error);
g_object_unref (task);
return;
This diff is collapsed.
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 15 May 2018 23:02:36 +0200
Subject: libgdm: use g_object_unref instead of g_clear_object for weakrefs
At the moment we add a weakref on each proxy to the connection
object. For the _sync variant functions, When the weakref fires,
they call g_clear_object, clearing the connection, even if other
proxies still have a reference.
This commit changes that weak ref code to use g_object_unref instead.
https://bugzilla.gnome.org/show_bug.cgi?id=795940
---
libgdm/gdm-client.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c
index c34121e..e02e3ea 100644
--- a/libgdm/gdm-client.c
+++ b/libgdm/gdm-client.c
@@ -764,8 +764,8 @@ gdm_client_get_user_verifier_sync (GdmClient *client,
&client->priv->user_verifier);
g_object_weak_ref (G_OBJECT (client->priv->user_verifier),
(GWeakNotify)
- g_clear_object,
- &client->priv->connection);
+ g_object_unref,
+ client->priv->connection);
if (client->priv->enabled_extensions != NULL) {
gboolean res;
@@ -1119,8 +1119,8 @@ gdm_client_get_greeter_sync (GdmClient *client,
&client->priv->greeter);
g_object_weak_ref (G_OBJECT (client->priv->greeter),
(GWeakNotify)
- g_clear_object,
- &client->priv->connection);
+ g_object_unref,
+ client->priv->connection);
query_for_timed_login_requested_signal (client->priv->greeter);
}
@@ -1294,8 +1294,8 @@ gdm_client_get_remote_greeter_sync (GdmClient *client,
&client->priv->remote_greeter);
g_object_weak_ref (G_OBJECT (client->priv->remote_greeter),
(GWeakNotify)
- g_clear_object,
- &client->priv->connection);
+ g_object_unref,
+ client->priv->connection);
}
return client->priv->remote_greeter;
@@ -1468,8 +1468,8 @@ gdm_client_get_chooser_sync (GdmClient *client,
&client->priv->chooser);
g_object_weak_ref (G_OBJECT (client->priv->chooser),
(GWeakNotify)
- g_clear_object,
- &client->priv->connection);
+ g_object_unref,
+ client->priv->connection);
}
return client->priv->chooser;
libgdm-drop-support-for-serializing-multiple-opens.patch
libgdm-fix-pointer-boolean-task-confusion.patch
libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch
libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch
libgdm-get-connection-explicitly.patch
libgdm-Drop-weak-refs-on-the-GDBusConnection.patch
libgdm-Unref-the-manager-propagated-from-task.patch
libgdm-Don-t-double-ref-the-connection-got-from-task.patch
libgdm-Don-t-leak-connection-on-sync-re-authentication.patch
libgdm-Use-auto-pointers-and-cleanup-code.patch
libgdb-Try-to-reuse-connections-from-the-available-proxie.patch
libgdm-Don-t-save-manager-address.patch
libgdm-Return-NULL-on-invalid-client-instances.patch
daemon-gdm-session-record.c-open-close-the-utmp-database.patch
16_xserver_path.patch
90_config_comments.patch
91_dconf_database_path.patch
......