Merge ~3v1n0/ubuntu/+source/gdm3:ubuntu/gdm-client-refcounting-issues-fix-18.04 into ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic
- Git
- lp:~3v1n0/ubuntu/+source/gdm3
- ubuntu/gdm-client-refcounting-issues-fix-18.04
- Merge into ubuntu/bionic
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Merged at revision: | 360f623ec83ca44a6e641e409481b32e2351f73f |
Proposed branch: | ~3v1n0/ubuntu/+source/gdm3:ubuntu/gdm-client-refcounting-issues-fix-18.04 |
Merge into: | ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/bionic |
Diff against target: |
1768 lines (+1674/-0) 15 files modified
debian/changelog (+20/-0) debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch (+162/-0) debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch (+35/-0) debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch (+21/-0) debian/patches/libgdm-Don-t-save-manager-address.patch (+102/-0) debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch (+128/-0) debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch (+84/-0) debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch (+36/-0) debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch (+65/-0) debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch (+315/-0) debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch (+189/-0) debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch (+47/-0) debian/patches/libgdm-get-connection-explicitly.patch (+393/-0) debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch (+64/-0) debian/patches/series (+13/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Iain Lane | Approve | ||
Review via email: mp+347421@code.launchpad.net |
Commit message
Cherry pick upstream 3.28 commits to fix ref-counting issues
Fixes LP: #1766137
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog |
2 | index ab353e6..fbbfdf9 100644 |
3 | --- a/debian/changelog |
4 | +++ b/debian/changelog |
5 | @@ -1,3 +1,23 @@ |
6 | +gdm3 (3.28.2-0ubuntu1.2) UNRELEASED; urgency=medium |
7 | + |
8 | + * debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch, |
9 | + debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch, |
10 | + debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch, |
11 | + debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch, |
12 | + debian/patches/libgdm-get-connection-explicitly.patch, |
13 | + debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch, |
14 | + debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch, |
15 | + debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch, |
16 | + debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch, |
17 | + debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch, |
18 | + debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch, |
19 | + debian/patches/libgdm-Don-t-save-manager-address.patch, |
20 | + debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch: |
21 | + - Cherry picks commits from upstream 3.28 branch to propely fix ref-counting |
22 | + issues on GdmClient (LP: #1766137) |
23 | + |
24 | + -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 05 Jun 2018 02:43:05 +0200 |
25 | + |
26 | gdm3 (3.28.2-0ubuntu1.1) bionic; urgency=medium |
27 | |
28 | * debian/gbp.conf: Add with 'bionic' configuration. |
29 | diff --git a/debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch b/debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch |
30 | new file mode 100644 |
31 | index 0000000..39b9c6c |
32 | --- /dev/null |
33 | +++ b/debian/patches/libgdb-Try-to-reuse-connections-from-the-available-proxie.patch |
34 | @@ -0,0 +1,162 @@ |
35 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
36 | +Date: Sat, 2 Jun 2018 19:34:08 +0200 |
37 | +Subject: libgdb: Try to reuse connections from the available proxies |
38 | + |
39 | +Instead of using the hard-to-maintain shared pointer to the dbus connection |
40 | +to the manager and reset it when the proxies that use it are deleted, just |
41 | +look which proxy is currently available and try to reuse the connection |
42 | +from it. |
43 | + |
44 | +Fixes #386 |
45 | +--- |
46 | + libgdm/gdm-client.c | 70 +++++++++++++++++++++++++++++------------------------ |
47 | + 1 file changed, 39 insertions(+), 31 deletions(-) |
48 | + |
49 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
50 | +index 7b42b6c..acf016a 100644 |
51 | +--- a/libgdm/gdm-client.c |
52 | ++++ b/libgdm/gdm-client.c |
53 | +@@ -46,7 +46,6 @@ struct GdmClientPrivate |
54 | + GdmGreeter *greeter; |
55 | + GdmRemoteGreeter *remote_greeter; |
56 | + GdmChooser *chooser; |
57 | +- GDBusConnection *connection; |
58 | + char *address; |
59 | + |
60 | + char **enabled_extensions; |
61 | +@@ -71,6 +70,28 @@ gdm_client_error_quark (void) |
62 | + return error_quark; |
63 | + } |
64 | + |
65 | ++static GDBusConnection * |
66 | ++gdm_client_get_open_connection (GdmClient *client) |
67 | ++{ |
68 | ++ GDBusProxy *proxy = NULL; |
69 | ++ |
70 | ++ if (client->priv->user_verifier != NULL) { |
71 | ++ proxy = G_DBUS_PROXY (client->priv->user_verifier); |
72 | ++ } else if (client->priv->greeter != NULL) { |
73 | ++ proxy = G_DBUS_PROXY (client->priv->greeter); |
74 | ++ } else if (client->priv->remote_greeter != NULL) { |
75 | ++ proxy = G_DBUS_PROXY (client->priv->remote_greeter); |
76 | ++ } else if (client->priv->chooser != NULL) { |
77 | ++ proxy = G_DBUS_PROXY (client->priv->chooser); |
78 | ++ } |
79 | ++ |
80 | ++ if (proxy != NULL) { |
81 | ++ return g_dbus_proxy_get_connection (proxy); |
82 | ++ } |
83 | ++ |
84 | ++ return NULL; |
85 | ++} |
86 | ++ |
87 | + static void |
88 | + on_got_manager (GObject *object, |
89 | + GAsyncResult *result, |
90 | +@@ -399,12 +420,15 @@ gdm_client_get_connection_sync (GdmClient *client, |
91 | + GError **error) |
92 | + { |
93 | + g_autoptr(GdmManager) manager = NULL; |
94 | ++ GDBusConnection *connection; |
95 | + gboolean ret; |
96 | + |
97 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
98 | + |
99 | +- if (client->priv->connection != NULL) { |
100 | +- return g_object_ref (client->priv->connection); |
101 | ++ connection = gdm_client_get_open_connection (client); |
102 | ++ |
103 | ++ if (connection != NULL) { |
104 | ++ return g_object_ref (connection); |
105 | + } |
106 | + |
107 | + manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
108 | +@@ -429,23 +453,19 @@ gdm_client_get_connection_sync (GdmClient *client, |
109 | + |
110 | + g_debug ("GdmClient: connecting to address: %s", client->priv->address); |
111 | + |
112 | +- client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address, |
113 | +- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
114 | +- NULL, |
115 | +- cancellable, |
116 | +- error); |
117 | ++ connection = g_dbus_connection_new_for_address_sync (client->priv->address, |
118 | ++ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
119 | ++ NULL, |
120 | ++ cancellable, |
121 | ++ error); |
122 | + |
123 | +- if (client->priv->connection == NULL) { |
124 | ++ if (connection == NULL) { |
125 | + g_clear_pointer (&client->priv->address, g_free); |
126 | + goto out; |
127 | + } |
128 | + |
129 | +- g_object_add_weak_pointer (G_OBJECT (client->priv->connection), |
130 | +- (gpointer *) |
131 | +- &client->priv->connection); |
132 | +- |
133 | + out: |
134 | +- return client->priv->connection; |
135 | ++ return connection; |
136 | + } |
137 | + |
138 | + static void |
139 | +@@ -545,12 +565,6 @@ gdm_client_get_connection_finish (GdmClient *client, |
140 | + return NULL; |
141 | + } |
142 | + |
143 | +- if (client->priv->connection == NULL) { |
144 | +- client->priv->connection = connection; |
145 | +- g_object_add_weak_pointer (G_OBJECT (client->priv->connection), |
146 | +- (gpointer *) &client->priv->connection); |
147 | +- } |
148 | +- |
149 | + return connection; |
150 | + } |
151 | + |
152 | +@@ -561,6 +575,7 @@ gdm_client_get_connection (GdmClient *client, |
153 | + gpointer user_data) |
154 | + { |
155 | + GTask *task; |
156 | ++ GDBusConnection *connection; |
157 | + |
158 | + g_return_if_fail (GDM_IS_CLIENT (client)); |
159 | + |
160 | +@@ -569,9 +584,10 @@ gdm_client_get_connection (GdmClient *client, |
161 | + callback, |
162 | + user_data); |
163 | + |
164 | +- if (client->priv->connection != NULL) { |
165 | ++ connection = gdm_client_get_open_connection (client); |
166 | ++ if (connection != NULL) { |
167 | + g_task_return_pointer (task, |
168 | +- g_object_ref (client->priv->connection), |
169 | ++ g_object_ref (connection), |
170 | + (GDestroyNotify) g_object_unref); |
171 | + g_object_unref (task); |
172 | + return; |
173 | +@@ -775,7 +791,7 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
174 | + if (strcmp (client->priv->enabled_extensions[i], |
175 | + gdm_user_verifier_choice_list_interface_info ()->name) == 0) { |
176 | + GdmUserVerifierChoiceList *choice_list_interface; |
177 | +- choice_list_interface = gdm_user_verifier_choice_list_proxy_new_sync (client->priv->connection, |
178 | ++ choice_list_interface = gdm_user_verifier_choice_list_proxy_new_sync (connection, |
179 | + G_DBUS_PROXY_FLAGS_NONE, |
180 | + NULL, |
181 | + SESSION_DBUS_PATH, |
182 | +@@ -1509,14 +1525,6 @@ gdm_client_finalize (GObject *object) |
183 | + &client->priv->chooser); |
184 | + } |
185 | + |
186 | +- if (client->priv->connection != NULL) { |
187 | +- g_object_remove_weak_pointer (G_OBJECT (client->priv->connection), |
188 | +- (gpointer *) |
189 | +- &client->priv->connection); |
190 | +- } |
191 | +- |
192 | +- g_clear_object (&client->priv->connection); |
193 | +- |
194 | + g_strfreev (client->priv->enabled_extensions); |
195 | + g_free (client->priv->address); |
196 | + |
197 | diff --git a/debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch b/debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch |
198 | new file mode 100644 |
199 | index 0000000..d7f6e9d |
200 | --- /dev/null |
201 | +++ b/debian/patches/libgdm-Don-t-double-ref-the-connection-got-from-task.patch |
202 | @@ -0,0 +1,35 @@ |
203 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
204 | +Date: Fri, 1 Jun 2018 17:16:35 +0200 |
205 | +Subject: libgdm: Don't double-ref the connection got from task |
206 | + |
207 | +Both if we re-use the shared connection in `gdm_client_get_connection` and if |
208 | +we create a new one in `on_connected`, we steal the pointer here by using |
209 | +`g_task_propagate_pointer` and thus we don't have to add an additional |
210 | +reference to this connection when returning, or it won't ever be consumed by |
211 | +function customers. |
212 | +--- |
213 | + libgdm/gdm-client.c | 4 ++-- |
214 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
215 | + |
216 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
217 | +index fa4ba84..3629214 100644 |
218 | +--- a/libgdm/gdm-client.c |
219 | ++++ b/libgdm/gdm-client.c |
220 | +@@ -536,7 +536,7 @@ gdm_client_get_connection_finish (GdmClient *client, |
221 | + GAsyncResult *result, |
222 | + GError **error) |
223 | + { |
224 | +- GDBusConnection *connection = NULL; |
225 | ++ GDBusConnection *connection; |
226 | + |
227 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
228 | + |
229 | +@@ -551,7 +551,7 @@ gdm_client_get_connection_finish (GdmClient *client, |
230 | + (gpointer *) &client->priv->connection); |
231 | + } |
232 | + |
233 | +- return g_object_ref (connection); |
234 | ++ return connection; |
235 | + } |
236 | + |
237 | + static void |
238 | diff --git a/debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch b/debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch |
239 | new file mode 100644 |
240 | index 0000000..547baf9 |
241 | --- /dev/null |
242 | +++ b/debian/patches/libgdm-Don-t-leak-connection-on-sync-re-authentication.patch |
243 | @@ -0,0 +1,21 @@ |
244 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
245 | +Date: Fri, 1 Jun 2018 17:20:17 +0200 |
246 | +Subject: libgdm: Don't leak connection on sync re-authentication |
247 | + |
248 | +--- |
249 | + libgdm/gdm-client.c | 2 +- |
250 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
251 | + |
252 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
253 | +index 3629214..335a040 100644 |
254 | +--- a/libgdm/gdm-client.c |
255 | ++++ b/libgdm/gdm-client.c |
256 | +@@ -604,7 +604,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
257 | + GCancellable *cancellable, |
258 | + GError **error) |
259 | + { |
260 | +- GDBusConnection *connection; |
261 | ++ g_autoptr(GDBusConnection) connection = NULL; |
262 | + g_autoptr(GdmManager) manager = NULL; |
263 | + GdmUserVerifier *user_verifier = NULL; |
264 | + gboolean ret; |
265 | diff --git a/debian/patches/libgdm-Don-t-save-manager-address.patch b/debian/patches/libgdm-Don-t-save-manager-address.patch |
266 | new file mode 100644 |
267 | index 0000000..1e3b7a5 |
268 | --- /dev/null |
269 | +++ b/debian/patches/libgdm-Don-t-save-manager-address.patch |
270 | @@ -0,0 +1,102 @@ |
271 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
272 | +Date: Sat, 2 Jun 2018 19:44:24 +0200 |
273 | +Subject: libgdm: Don't save manager address |
274 | + |
275 | +There's no need to keep the manager connection address around, and |
276 | +use autofree to clean it up |
277 | +--- |
278 | + libgdm/gdm-client.c | 24 +++++++++--------------- |
279 | + 1 file changed, 9 insertions(+), 15 deletions(-) |
280 | + |
281 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
282 | +index acf016a..0e8bf43 100644 |
283 | +--- a/libgdm/gdm-client.c |
284 | ++++ b/libgdm/gdm-client.c |
285 | +@@ -46,7 +46,6 @@ struct GdmClientPrivate |
286 | + GdmGreeter *greeter; |
287 | + GdmRemoteGreeter *remote_greeter; |
288 | + GdmChooser *chooser; |
289 | +- char *address; |
290 | + |
291 | + char **enabled_extensions; |
292 | + }; |
293 | +@@ -420,6 +419,7 @@ gdm_client_get_connection_sync (GdmClient *client, |
294 | + GError **error) |
295 | + { |
296 | + g_autoptr(GdmManager) manager = NULL; |
297 | ++ g_autofree char *address = NULL; |
298 | + GDBusConnection *connection; |
299 | + gboolean ret; |
300 | + |
301 | +@@ -439,32 +439,26 @@ gdm_client_get_connection_sync (GdmClient *client, |
302 | + error); |
303 | + |
304 | + if (manager == NULL) { |
305 | +- goto out; |
306 | ++ return NULL; |
307 | + } |
308 | + |
309 | + ret = gdm_manager_call_open_session_sync (manager, |
310 | +- &client->priv->address, |
311 | ++ &address, |
312 | + cancellable, |
313 | + error); |
314 | + |
315 | + if (!ret) { |
316 | +- goto out; |
317 | ++ return NULL; |
318 | + } |
319 | + |
320 | +- g_debug ("GdmClient: connecting to address: %s", client->priv->address); |
321 | ++ g_debug ("GdmClient: connecting to address: %s", address); |
322 | + |
323 | +- connection = g_dbus_connection_new_for_address_sync (client->priv->address, |
324 | ++ connection = g_dbus_connection_new_for_address_sync (address, |
325 | + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
326 | + NULL, |
327 | + cancellable, |
328 | + error); |
329 | + |
330 | +- if (connection == NULL) { |
331 | +- g_clear_pointer (&client->priv->address, g_free); |
332 | +- goto out; |
333 | +- } |
334 | +- |
335 | +- out: |
336 | + return connection; |
337 | + } |
338 | + |
339 | +@@ -497,6 +491,7 @@ on_session_opened (GdmManager *manager, |
340 | + GTask *task) |
341 | + { |
342 | + GdmClient *client; |
343 | ++ g_autofree char *address = NULL; |
344 | + GCancellable *cancellable; |
345 | + GError *error; |
346 | + |
347 | +@@ -504,7 +499,7 @@ on_session_opened (GdmManager *manager, |
348 | + |
349 | + error = NULL; |
350 | + if (!gdm_manager_call_open_session_finish (manager, |
351 | +- &client->priv->address, |
352 | ++ &address, |
353 | + result, |
354 | + &error)) { |
355 | + g_task_return_error (task, error); |
356 | +@@ -514,7 +509,7 @@ on_session_opened (GdmManager *manager, |
357 | + } |
358 | + |
359 | + cancellable = g_task_get_cancellable (task); |
360 | +- g_dbus_connection_new_for_address (client->priv->address, |
361 | ++ g_dbus_connection_new_for_address (address, |
362 | + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
363 | + NULL, |
364 | + cancellable, |
365 | +@@ -1526,7 +1521,6 @@ gdm_client_finalize (GObject *object) |
366 | + } |
367 | + |
368 | + g_strfreev (client->priv->enabled_extensions); |
369 | +- g_free (client->priv->address); |
370 | + |
371 | + G_OBJECT_CLASS (gdm_client_parent_class)->finalize (object); |
372 | + } |
373 | diff --git a/debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch b/debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch |
374 | new file mode 100644 |
375 | index 0000000..12070a1 |
376 | --- /dev/null |
377 | +++ b/debian/patches/libgdm-Drop-weak-refs-on-the-GDBusConnection.patch |
378 | @@ -0,0 +1,128 @@ |
379 | +From: Iain Lane <iainl@gnome.org> |
380 | +Date: Mon, 14 May 2018 22:32:25 +0200 |
381 | +Subject: libgdm: Drop weak refs on the GDBusConnection |
382 | + |
383 | +The GDBusProxies hold a strong reference to the connection themselves, |
384 | +so maintaining separate weak references is unnecessary. |
385 | + |
386 | +This commit drops those extraneous weak references. |
387 | + |
388 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
389 | +--- |
390 | + libgdm/gdm-client.c | 47 ----------------------------------------------- |
391 | + 1 file changed, 47 deletions(-) |
392 | + |
393 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
394 | +index e7b93e3..f327344 100644 |
395 | +--- a/libgdm/gdm-client.c |
396 | ++++ b/libgdm/gdm-client.c |
397 | +@@ -652,13 +652,6 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
398 | + cancellable, |
399 | + error); |
400 | + |
401 | +- if (user_verifier != NULL) { |
402 | +- g_object_weak_ref (G_OBJECT (user_verifier), |
403 | +- (GWeakNotify) |
404 | +- g_object_unref, |
405 | +- connection); |
406 | +- } |
407 | +- |
408 | + out: |
409 | + return user_verifier; |
410 | + } |
411 | +@@ -763,12 +756,6 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
412 | + g_object_add_weak_pointer (G_OBJECT (client->priv->user_verifier), |
413 | + (gpointer *) |
414 | + &client->priv->user_verifier); |
415 | +- g_object_ref (connection); |
416 | +- g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
417 | +- (GWeakNotify) |
418 | +- g_object_unref, |
419 | +- client->priv->connection); |
420 | +- |
421 | + if (client->priv->enabled_extensions != NULL) { |
422 | + gboolean res; |
423 | + |
424 | +@@ -908,11 +895,6 @@ gdm_client_get_user_verifier_finish (GdmClient *client, |
425 | + (gpointer *) |
426 | + &client->priv->user_verifier); |
427 | + |
428 | +- g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
429 | +- (GWeakNotify) |
430 | +- g_object_unref, |
431 | +- client->priv->connection); |
432 | +- |
433 | + return user_verifier; |
434 | + } |
435 | + |
436 | +@@ -1081,10 +1063,6 @@ gdm_client_get_greeter_finish (GdmClient *client, |
437 | + (gpointer *) |
438 | + &client->priv->greeter); |
439 | + |
440 | +- g_object_weak_ref (G_OBJECT (client->priv->greeter), |
441 | +- (GWeakNotify) |
442 | +- g_object_unref, |
443 | +- client->priv->connection); |
444 | + return greeter; |
445 | + } |
446 | + |
447 | +@@ -1129,10 +1107,6 @@ gdm_client_get_greeter_sync (GdmClient *client, |
448 | + g_object_add_weak_pointer (G_OBJECT (client->priv->greeter), |
449 | + (gpointer *) |
450 | + &client->priv->greeter); |
451 | +- g_object_weak_ref (G_OBJECT (client->priv->greeter), |
452 | +- (GWeakNotify) |
453 | +- g_object_unref, |
454 | +- client->priv->connection); |
455 | + |
456 | + query_for_timed_login_requested_signal (client->priv->greeter); |
457 | + } |
458 | +@@ -1263,11 +1237,6 @@ gdm_client_get_remote_greeter_finish (GdmClient *client, |
459 | + (gpointer *) |
460 | + &client->priv->remote_greeter); |
461 | + |
462 | +- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
463 | +- (GWeakNotify) |
464 | +- g_object_unref, |
465 | +- client->priv->connection); |
466 | +- |
467 | + return remote_greeter; |
468 | + } |
469 | + |
470 | +@@ -1311,11 +1280,6 @@ gdm_client_get_remote_greeter_sync (GdmClient *client, |
471 | + g_object_add_weak_pointer (G_OBJECT (client->priv->remote_greeter), |
472 | + (gpointer *) |
473 | + &client->priv->remote_greeter); |
474 | +- g_object_ref (connection); |
475 | +- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
476 | +- (GWeakNotify) |
477 | +- g_object_unref, |
478 | +- client->priv->connection); |
479 | + } |
480 | + |
481 | + return client->priv->remote_greeter; |
482 | +@@ -1444,12 +1408,6 @@ gdm_client_get_chooser_finish (GdmClient *client, |
483 | + (gpointer *) |
484 | + &client->priv->chooser); |
485 | + |
486 | +- g_object_ref (connection); |
487 | +- g_object_weak_ref (G_OBJECT (client->priv->chooser), |
488 | +- (GWeakNotify) |
489 | +- g_object_unref, |
490 | +- client->priv->connection); |
491 | +- |
492 | + return chooser; |
493 | + } |
494 | + |
495 | +@@ -1493,11 +1451,6 @@ gdm_client_get_chooser_sync (GdmClient *client, |
496 | + g_object_add_weak_pointer (G_OBJECT (client->priv->chooser), |
497 | + (gpointer *) |
498 | + &client->priv->chooser); |
499 | +- g_object_ref (connection); |
500 | +- g_object_weak_ref (G_OBJECT (client->priv->chooser), |
501 | +- (GWeakNotify) |
502 | +- g_object_unref, |
503 | +- client->priv->connection); |
504 | + } |
505 | + |
506 | + return client->priv->chooser; |
507 | diff --git a/debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch b/debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch |
508 | new file mode 100644 |
509 | index 0000000..40cb122 |
510 | --- /dev/null |
511 | +++ b/debian/patches/libgdm-Return-NULL-on-invalid-client-instances.patch |
512 | @@ -0,0 +1,84 @@ |
513 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
514 | +Date: Mon, 4 Jun 2018 19:13:04 +0200 |
515 | +Subject: libgdm: Return NULL on invalid client instances |
516 | + |
517 | +--- |
518 | + libgdm/gdm-client.c | 16 ++++++++-------- |
519 | + 1 file changed, 8 insertions(+), 8 deletions(-) |
520 | + |
521 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
522 | +index 0e8bf43..28cb725 100644 |
523 | +--- a/libgdm/gdm-client.c |
524 | ++++ b/libgdm/gdm-client.c |
525 | +@@ -423,7 +423,7 @@ gdm_client_get_connection_sync (GdmClient *client, |
526 | + GDBusConnection *connection; |
527 | + gboolean ret; |
528 | + |
529 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
530 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
531 | + |
532 | + connection = gdm_client_get_open_connection (client); |
533 | + |
534 | +@@ -553,7 +553,7 @@ gdm_client_get_connection_finish (GdmClient *client, |
535 | + { |
536 | + GDBusConnection *connection; |
537 | + |
538 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
539 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
540 | + |
541 | + connection = g_task_propagate_pointer (G_TASK (result), error); |
542 | + if (connection == NULL) { |
543 | +@@ -621,7 +621,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
544 | + GdmUserVerifier *user_verifier = NULL; |
545 | + gboolean ret; |
546 | + |
547 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
548 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
549 | + |
550 | + manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
551 | + G_DBUS_PROXY_FLAGS_NONE, |
552 | +@@ -722,7 +722,7 @@ gdm_client_open_reauthentication_channel_finish (GdmClient *client, |
553 | + GAsyncResult *result, |
554 | + GError **error) |
555 | + { |
556 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
557 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
558 | + |
559 | + return g_task_propagate_pointer (G_TASK (result), error); |
560 | + } |
561 | +@@ -890,7 +890,7 @@ gdm_client_get_user_verifier_finish (GdmClient *client, |
562 | + { |
563 | + GdmUserVerifier *user_verifier; |
564 | + |
565 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
566 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
567 | + |
568 | + if (client->priv->user_verifier != NULL) |
569 | + return g_object_ref (client->priv->user_verifier); |
570 | +@@ -1058,7 +1058,7 @@ gdm_client_get_greeter_finish (GdmClient *client, |
571 | + { |
572 | + GdmGreeter *greeter; |
573 | + |
574 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
575 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
576 | + |
577 | + if (client->priv->greeter != NULL) |
578 | + return g_object_ref (client->priv->greeter); |
579 | +@@ -1232,7 +1232,7 @@ gdm_client_get_remote_greeter_finish (GdmClient *client, |
580 | + { |
581 | + GdmRemoteGreeter *remote_greeter; |
582 | + |
583 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
584 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
585 | + |
586 | + if (client->priv->remote_greeter != NULL) |
587 | + return g_object_ref (client->priv->remote_greeter); |
588 | +@@ -1403,7 +1403,7 @@ gdm_client_get_chooser_finish (GdmClient *client, |
589 | + { |
590 | + GdmChooser *chooser; |
591 | + |
592 | +- g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
593 | ++ g_return_val_if_fail (GDM_IS_CLIENT (client), NULL); |
594 | + |
595 | + if (client->priv->chooser != NULL) |
596 | + return g_object_ref (client->priv->chooser); |
597 | diff --git a/debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch b/debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch |
598 | new file mode 100644 |
599 | index 0000000..ac5acc1 |
600 | --- /dev/null |
601 | +++ b/debian/patches/libgdm-Unref-the-manager-propagated-from-task.patch |
602 | @@ -0,0 +1,36 @@ |
603 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
604 | +Date: Fri, 1 Jun 2018 17:07:41 +0200 |
605 | +Subject: libgdm: Unref the manager propagated from task |
606 | + |
607 | +This instance has already been reffed when passed to the task, and since |
608 | +we're stealing it with `g_task_propagate_pointer` it won't be unreffed. |
609 | + |
610 | +We could also do this in the `on_reauthentication_channel_opened` callback |
611 | +but since the new task will ref it anyway, we can just be clean and do it |
612 | +here. |
613 | +--- |
614 | + libgdm/gdm-client.c | 4 +++- |
615 | + 1 file changed, 3 insertions(+), 1 deletion(-) |
616 | + |
617 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
618 | +index f327344..fa4ba84 100644 |
619 | +--- a/libgdm/gdm-client.c |
620 | ++++ b/libgdm/gdm-client.c |
621 | +@@ -390,7 +390,7 @@ on_got_manager_for_reauthentication (GdmClient *client, |
622 | + (GAsyncReadyCallback) |
623 | + on_reauthentication_channel_opened, |
624 | + task); |
625 | +- |
626 | ++ g_object_unref (manager); |
627 | + } |
628 | + |
629 | + static GDBusConnection * |
630 | +@@ -527,6 +527,8 @@ on_got_manager_for_opening_connection (GdmClient *client, |
631 | + (GAsyncReadyCallback) |
632 | + on_session_opened, |
633 | + task); |
634 | ++ |
635 | ++ g_object_unref (manager); |
636 | + } |
637 | + |
638 | + static GDBusConnection * |
639 | diff --git a/debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch b/debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch |
640 | new file mode 100644 |
641 | index 0000000..cd59a5e |
642 | --- /dev/null |
643 | +++ b/debian/patches/libgdm-Use-auto-pointers-and-cleanup-code.patch |
644 | @@ -0,0 +1,65 @@ |
645 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
646 | +Date: Fri, 1 Jun 2018 17:22:20 +0200 |
647 | +Subject: libgdm: Use auto-pointers and cleanup code |
648 | + |
649 | +--- |
650 | + libgdm/gdm-client.c | 13 +++++-------- |
651 | + 1 file changed, 5 insertions(+), 8 deletions(-) |
652 | + |
653 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
654 | +index 335a040..7b42b6c 100644 |
655 | +--- a/libgdm/gdm-client.c |
656 | ++++ b/libgdm/gdm-client.c |
657 | +@@ -606,9 +606,9 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
658 | + { |
659 | + g_autoptr(GDBusConnection) connection = NULL; |
660 | + g_autoptr(GdmManager) manager = NULL; |
661 | ++ g_autofree char *address = NULL; |
662 | + GdmUserVerifier *user_verifier = NULL; |
663 | + gboolean ret; |
664 | +- char *address; |
665 | + |
666 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
667 | + |
668 | +@@ -620,7 +620,7 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
669 | + error); |
670 | + |
671 | + if (manager == NULL) { |
672 | +- goto out; |
673 | ++ return NULL; |
674 | + } |
675 | + |
676 | + ret = gdm_manager_call_open_reauthentication_channel_sync (manager, |
677 | +@@ -630,10 +630,10 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
678 | + error); |
679 | + |
680 | + if (!ret) { |
681 | +- goto out; |
682 | ++ return NULL; |
683 | + } |
684 | + |
685 | +- g_debug ("GdmClient: connecting to address: %s", client->priv->address); |
686 | ++ g_debug ("GdmClient: connecting to address: %s", address); |
687 | + |
688 | + connection = g_dbus_connection_new_for_address_sync (address, |
689 | + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
690 | +@@ -642,10 +642,8 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
691 | + error); |
692 | + |
693 | + if (connection == NULL) { |
694 | +- g_free (address); |
695 | +- goto out; |
696 | ++ return NULL; |
697 | + } |
698 | +- g_free (address); |
699 | + |
700 | + user_verifier = gdm_user_verifier_proxy_new_sync (connection, |
701 | + G_DBUS_PROXY_FLAGS_NONE, |
702 | +@@ -654,7 +652,6 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
703 | + cancellable, |
704 | + error); |
705 | + |
706 | +- out: |
707 | + return user_verifier; |
708 | + } |
709 | + |
710 | diff --git a/debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch b/debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch |
711 | new file mode 100644 |
712 | index 0000000..e3fde3f |
713 | --- /dev/null |
714 | +++ b/debian/patches/libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch |
715 | @@ -0,0 +1,315 @@ |
716 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
717 | +Date: Mon, 4 Jun 2018 22:34:59 +0200 |
718 | +Subject: libgdm: don't keep manager proxy around longer than we need it |
719 | +MIME-Version: 1.0 |
720 | +Content-Type: text/plain; charset="utf-8" |
721 | +Content-Transfer-Encoding: 8bit |
722 | + |
723 | +Right now we keep the manager proxy alive long after we need it. |
724 | +It doesn't get cleared until one of the other proxies go away. |
725 | + |
726 | +That is not only unnecessary but illogical and confusing. |
727 | + |
728 | +This commit changes the manager proxy to be transient—only alive |
729 | +long enough to get what we need from it. |
730 | + |
731 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
732 | +--- |
733 | + libgdm/gdm-client.c | 127 +++++++++++++--------------------------------------- |
734 | + 1 file changed, 30 insertions(+), 97 deletions(-) |
735 | + |
736 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
737 | +index 06dfe72..c34121e 100644 |
738 | +--- a/libgdm/gdm-client.c |
739 | ++++ b/libgdm/gdm-client.c |
740 | +@@ -40,8 +40,6 @@ |
741 | + |
742 | + struct GdmClientPrivate |
743 | + { |
744 | +- GdmManager *manager; |
745 | +- |
746 | + GdmUserVerifier *user_verifier; |
747 | + GHashTable *user_verifier_extensions; |
748 | + |
749 | +@@ -74,34 +72,24 @@ gdm_client_error_quark (void) |
750 | + } |
751 | + |
752 | + static void |
753 | +-on_got_manager (GdmManager *manager, |
754 | ++on_got_manager (GObject *object, |
755 | + GAsyncResult *result, |
756 | + GTask *task) |
757 | + { |
758 | + GdmClient *client; |
759 | +- GdmManager *new_manager; |
760 | +- GError *error; |
761 | ++ GError *error; |
762 | ++ g_autoptr(GdmManager) manager = NULL; |
763 | + |
764 | + client = GDM_CLIENT (g_async_result_get_source_object (G_ASYNC_RESULT (task))); |
765 | + |
766 | + error = NULL; |
767 | +- new_manager = gdm_manager_proxy_new_finish (result, &error); |
768 | +- |
769 | +- if (client->priv->manager == NULL) { |
770 | +- client->priv->manager = new_manager; |
771 | +- |
772 | +- } else { |
773 | +- g_object_ref (client->priv->manager); |
774 | +- g_object_unref (new_manager); |
775 | +- |
776 | +- g_clear_error (&error); |
777 | +- } |
778 | ++ manager = gdm_manager_proxy_new_finish (result, &error); |
779 | + |
780 | + if (error != NULL) { |
781 | + g_task_return_error (task, error); |
782 | + } else { |
783 | + g_task_return_pointer (task, |
784 | +- g_object_ref (client->priv->manager), |
785 | ++ g_object_ref (manager), |
786 | + (GDestroyNotify) g_object_unref); |
787 | + } |
788 | + |
789 | +@@ -122,14 +110,6 @@ get_manager (GdmClient *client, |
790 | + callback, |
791 | + user_data); |
792 | + |
793 | +- if (client->priv->manager != NULL) { |
794 | +- g_task_return_pointer (task, |
795 | +- g_object_ref (client->priv->manager), |
796 | +- (GDestroyNotify) g_object_unref); |
797 | +- g_object_unref (task); |
798 | +- return; |
799 | +- } |
800 | +- |
801 | + gdm_manager_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, |
802 | + G_DBUS_PROXY_FLAGS_NONE, |
803 | + "org.gnome.DisplayManager", |
804 | +@@ -404,7 +384,7 @@ on_got_manager_for_reauthentication (GdmClient *client, |
805 | + |
806 | + cancellable = g_task_get_cancellable (task); |
807 | + username = g_object_get_data (G_OBJECT (task), "username"); |
808 | +- gdm_manager_call_open_reauthentication_channel (client->priv->manager, |
809 | ++ gdm_manager_call_open_reauthentication_channel (manager, |
810 | + username, |
811 | + cancellable, |
812 | + (GAsyncReadyCallback) |
813 | +@@ -418,6 +398,7 @@ gdm_client_open_connection_sync (GdmClient *client, |
814 | + GCancellable *cancellable, |
815 | + GError **error) |
816 | + { |
817 | ++ g_autoptr(GdmManager) manager = NULL; |
818 | + gboolean ret; |
819 | + |
820 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
821 | +@@ -427,24 +408,23 @@ gdm_client_open_connection_sync (GdmClient *client, |
822 | + return TRUE; |
823 | + } |
824 | + |
825 | +- client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
826 | +- G_DBUS_PROXY_FLAGS_NONE, |
827 | +- "org.gnome.DisplayManager", |
828 | +- "/org/gnome/DisplayManager/Manager", |
829 | +- cancellable, |
830 | +- error); |
831 | ++ manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
832 | ++ G_DBUS_PROXY_FLAGS_NONE, |
833 | ++ "org.gnome.DisplayManager", |
834 | ++ "/org/gnome/DisplayManager/Manager", |
835 | ++ cancellable, |
836 | ++ error); |
837 | + |
838 | +- if (client->priv->manager == NULL) { |
839 | ++ if (manager == NULL) { |
840 | + goto out; |
841 | + } |
842 | + |
843 | +- ret = gdm_manager_call_open_session_sync (client->priv->manager, |
844 | ++ ret = gdm_manager_call_open_session_sync (manager, |
845 | + &client->priv->address, |
846 | + cancellable, |
847 | + error); |
848 | + |
849 | + if (!ret) { |
850 | +- g_clear_object (&client->priv->manager); |
851 | + goto out; |
852 | + } |
853 | + |
854 | +@@ -457,7 +437,6 @@ gdm_client_open_connection_sync (GdmClient *client, |
855 | + error); |
856 | + |
857 | + if (client->priv->connection == NULL) { |
858 | +- g_clear_object (&client->priv->manager); |
859 | + g_clear_pointer (&client->priv->address, g_free); |
860 | + goto out; |
861 | + } |
862 | +@@ -544,7 +523,7 @@ on_got_manager_for_opening_connection (GdmClient *client, |
863 | + } |
864 | + |
865 | + cancellable = g_task_get_cancellable (task); |
866 | +- gdm_manager_call_open_session (client->priv->manager, |
867 | ++ gdm_manager_call_open_session (manager, |
868 | + cancellable, |
869 | + (GAsyncReadyCallback) |
870 | + on_session_opened, |
871 | +@@ -627,28 +606,25 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
872 | + GError **error) |
873 | + { |
874 | + GDBusConnection *connection; |
875 | ++ g_autoptr(GdmManager) manager = NULL; |
876 | + GdmUserVerifier *user_verifier = NULL; |
877 | + gboolean ret; |
878 | + char *address; |
879 | + |
880 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
881 | + |
882 | +- if (client->priv->manager == NULL) { |
883 | +- client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
884 | +- G_DBUS_PROXY_FLAGS_NONE, |
885 | +- "org.gnome.DisplayManager", |
886 | +- "/org/gnome/DisplayManager/Manager", |
887 | +- cancellable, |
888 | +- error); |
889 | ++ manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
890 | ++ G_DBUS_PROXY_FLAGS_NONE, |
891 | ++ "org.gnome.DisplayManager", |
892 | ++ "/org/gnome/DisplayManager/Manager", |
893 | ++ cancellable, |
894 | ++ error); |
895 | + |
896 | +- if (client->priv->manager == NULL) { |
897 | +- goto out; |
898 | +- } |
899 | +- } else { |
900 | +- client->priv->manager = g_object_ref (client->priv->manager); |
901 | ++ if (manager == NULL) { |
902 | ++ goto out; |
903 | + } |
904 | + |
905 | +- ret = gdm_manager_call_open_reauthentication_channel_sync (client->priv->manager, |
906 | ++ ret = gdm_manager_call_open_reauthentication_channel_sync (manager, |
907 | + username, |
908 | + &address, |
909 | + cancellable, |
910 | +@@ -684,11 +660,6 @@ gdm_client_open_reauthentication_channel_sync (GdmClient *client, |
911 | + (GWeakNotify) |
912 | + g_object_unref, |
913 | + connection); |
914 | +- |
915 | +- g_object_weak_ref (G_OBJECT (user_verifier), |
916 | +- (GWeakNotify) |
917 | +- g_clear_object, |
918 | +- &client->priv->manager); |
919 | + } |
920 | + |
921 | + out: |
922 | +@@ -794,11 +765,7 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
923 | + g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
924 | + (GWeakNotify) |
925 | + g_clear_object, |
926 | +- &client->priv->manager); |
927 | +- g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
928 | +- (GWeakNotify) |
929 | +- g_object_unref, |
930 | +- client->priv->connection); |
931 | ++ &client->priv->connection); |
932 | + |
933 | + if (client->priv->enabled_extensions != NULL) { |
934 | + gboolean res; |
935 | +@@ -941,11 +908,6 @@ gdm_client_get_user_verifier_finish (GdmClient *client, |
936 | + g_object_unref, |
937 | + client->priv->connection); |
938 | + |
939 | +- g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
940 | +- (GWeakNotify) |
941 | +- g_clear_object, |
942 | +- &client->priv->manager); |
943 | +- |
944 | + return user_verifier; |
945 | + } |
946 | + |
947 | +@@ -1115,12 +1077,6 @@ gdm_client_get_greeter_finish (GdmClient *client, |
948 | + (GWeakNotify) |
949 | + g_object_unref, |
950 | + client->priv->connection); |
951 | +- |
952 | +- g_object_weak_ref (G_OBJECT (client->priv->greeter), |
953 | +- (GWeakNotify) |
954 | +- g_clear_object, |
955 | +- &client->priv->manager); |
956 | +- |
957 | + return greeter; |
958 | + } |
959 | + |
960 | +@@ -1164,11 +1120,7 @@ gdm_client_get_greeter_sync (GdmClient *client, |
961 | + g_object_weak_ref (G_OBJECT (client->priv->greeter), |
962 | + (GWeakNotify) |
963 | + g_clear_object, |
964 | +- &client->priv->manager); |
965 | +- g_object_weak_ref (G_OBJECT (client->priv->greeter), |
966 | +- (GWeakNotify) |
967 | +- g_object_unref, |
968 | +- client->priv->connection); |
969 | ++ &client->priv->connection); |
970 | + |
971 | + query_for_timed_login_requested_signal (client->priv->greeter); |
972 | + } |
973 | +@@ -1301,11 +1253,6 @@ gdm_client_get_remote_greeter_finish (GdmClient *client, |
974 | + g_object_unref, |
975 | + client->priv->connection); |
976 | + |
977 | +- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
978 | +- (GWeakNotify) |
979 | +- g_clear_object, |
980 | +- &client->priv->manager); |
981 | +- |
982 | + return remote_greeter; |
983 | + } |
984 | + |
985 | +@@ -1348,11 +1295,7 @@ gdm_client_get_remote_greeter_sync (GdmClient *client, |
986 | + g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
987 | + (GWeakNotify) |
988 | + g_clear_object, |
989 | +- &client->priv->manager); |
990 | +- g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
991 | +- (GWeakNotify) |
992 | +- g_object_unref, |
993 | +- client->priv->connection); |
994 | ++ &client->priv->connection); |
995 | + } |
996 | + |
997 | + return client->priv->remote_greeter; |
998 | +@@ -1483,11 +1426,6 @@ gdm_client_get_chooser_finish (GdmClient *client, |
999 | + g_object_unref, |
1000 | + client->priv->connection); |
1001 | + |
1002 | +- g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1003 | +- (GWeakNotify) |
1004 | +- g_clear_object, |
1005 | +- &client->priv->manager); |
1006 | +- |
1007 | + return chooser; |
1008 | + } |
1009 | + |
1010 | +@@ -1531,11 +1469,7 @@ gdm_client_get_chooser_sync (GdmClient *client, |
1011 | + g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1012 | + (GWeakNotify) |
1013 | + g_clear_object, |
1014 | +- &client->priv->manager); |
1015 | +- g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1016 | +- (GWeakNotify) |
1017 | +- g_object_unref, |
1018 | +- client->priv->connection); |
1019 | ++ &client->priv->connection); |
1020 | + } |
1021 | + |
1022 | + return client->priv->chooser; |
1023 | +@@ -1601,7 +1535,6 @@ gdm_client_finalize (GObject *object) |
1024 | + &client->priv->connection); |
1025 | + } |
1026 | + |
1027 | +- g_clear_object (&client->priv->manager); |
1028 | + g_clear_object (&client->priv->connection); |
1029 | + |
1030 | + g_strfreev (client->priv->enabled_extensions); |
1031 | diff --git a/debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch b/debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch |
1032 | new file mode 100644 |
1033 | index 0000000..a26cf59 |
1034 | --- /dev/null |
1035 | +++ b/debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch |
1036 | @@ -0,0 +1,189 @@ |
1037 | +From: Ray Strode <rstrode@redhat.com> |
1038 | +Date: Mon, 14 May 2018 14:48:31 -0400 |
1039 | +Subject: libgdm: drop support for serializing multiple opens |
1040 | + |
1041 | +Right now libgdm tries to handle multiple simultaneous |
1042 | +open calls at the same time by serializing the requests |
1043 | +and giving them all the same connection. It's broken, |
1044 | +though. |
1045 | + |
1046 | + - The pending_opens list is never populated, so we |
1047 | + end up just doing multiple simultaneous open |
1048 | + operations at a time anyway. |
1049 | + - The finish code ends up calling |
1050 | + g_task_return_error (task, NULL) instead of |
1051 | + g_task_return_pointer in the non-error case. |
1052 | + |
1053 | +Since the feature doesn't work, drop it for now. |
1054 | + |
1055 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
1056 | +--- |
1057 | + libgdm/gdm-client.c | 111 +++++++++++++++++++--------------------------------- |
1058 | + 1 file changed, 40 insertions(+), 71 deletions(-) |
1059 | + |
1060 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
1061 | +index 294f4f4..a88a5d7 100644 |
1062 | +--- a/libgdm/gdm-client.c |
1063 | ++++ b/libgdm/gdm-client.c |
1064 | +@@ -51,7 +51,6 @@ struct GdmClientPrivate |
1065 | + GDBusConnection *connection; |
1066 | + char *address; |
1067 | + |
1068 | +- GList *pending_opens; |
1069 | + char **enabled_extensions; |
1070 | + }; |
1071 | + |
1072 | +@@ -421,53 +420,50 @@ gdm_client_open_connection_sync (GdmClient *client, |
1073 | + |
1074 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
1075 | + |
1076 | +- if (client->priv->manager == NULL) { |
1077 | +- client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
1078 | +- G_DBUS_PROXY_FLAGS_NONE, |
1079 | +- "org.gnome.DisplayManager", |
1080 | +- "/org/gnome/DisplayManager/Manager", |
1081 | +- cancellable, |
1082 | +- error); |
1083 | +- |
1084 | +- if (client->priv->manager == NULL) { |
1085 | +- goto out; |
1086 | +- } |
1087 | +- } else { |
1088 | +- client->priv->manager = g_object_ref (client->priv->manager); |
1089 | ++ if (client->priv->connection != NULL) { |
1090 | ++ g_object_ref (client->priv->connection); |
1091 | ++ return TRUE; |
1092 | + } |
1093 | + |
1094 | +- if (client->priv->connection == NULL) { |
1095 | +- ret = gdm_manager_call_open_session_sync (client->priv->manager, |
1096 | +- &client->priv->address, |
1097 | +- cancellable, |
1098 | +- error); |
1099 | ++ client->priv->manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
1100 | ++ G_DBUS_PROXY_FLAGS_NONE, |
1101 | ++ "org.gnome.DisplayManager", |
1102 | ++ "/org/gnome/DisplayManager/Manager", |
1103 | ++ cancellable, |
1104 | ++ error); |
1105 | + |
1106 | +- if (!ret) { |
1107 | +- g_clear_object (&client->priv->manager); |
1108 | +- goto out; |
1109 | +- } |
1110 | ++ if (client->priv->manager == NULL) { |
1111 | ++ goto out; |
1112 | ++ } |
1113 | ++ |
1114 | ++ ret = gdm_manager_call_open_session_sync (client->priv->manager, |
1115 | ++ &client->priv->address, |
1116 | ++ cancellable, |
1117 | ++ error); |
1118 | + |
1119 | +- g_debug ("GdmClient: connecting to address: %s", client->priv->address); |
1120 | ++ if (!ret) { |
1121 | ++ g_clear_object (&client->priv->manager); |
1122 | ++ goto out; |
1123 | ++ } |
1124 | + |
1125 | +- client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address, |
1126 | +- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
1127 | +- NULL, |
1128 | +- cancellable, |
1129 | +- error); |
1130 | ++ g_debug ("GdmClient: connecting to address: %s", client->priv->address); |
1131 | + |
1132 | +- if (client->priv->connection == NULL) { |
1133 | +- g_clear_object (&client->priv->manager); |
1134 | +- g_clear_pointer (&client->priv->address, g_free); |
1135 | +- goto out; |
1136 | +- } |
1137 | ++ client->priv->connection = g_dbus_connection_new_for_address_sync (client->priv->address, |
1138 | ++ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, |
1139 | ++ NULL, |
1140 | ++ cancellable, |
1141 | ++ error); |
1142 | + |
1143 | +- g_object_add_weak_pointer (G_OBJECT (client->priv->connection), |
1144 | +- (gpointer *) |
1145 | +- &client->priv->connection); |
1146 | +- } else { |
1147 | +- client->priv->connection = g_object_ref (client->priv->connection); |
1148 | ++ if (client->priv->connection == NULL) { |
1149 | ++ g_clear_object (&client->priv->manager); |
1150 | ++ g_clear_pointer (&client->priv->address, g_free); |
1151 | ++ goto out; |
1152 | + } |
1153 | + |
1154 | ++ g_object_add_weak_pointer (G_OBJECT (client->priv->connection), |
1155 | ++ (gpointer *) |
1156 | ++ &client->priv->connection); |
1157 | ++ |
1158 | + out: |
1159 | + return client->priv->connection != NULL; |
1160 | + } |
1161 | +@@ -551,25 +547,6 @@ on_got_manager_for_opening_connection (GdmClient *client, |
1162 | + task); |
1163 | + } |
1164 | + |
1165 | +-static void |
1166 | +-finish_pending_opens (GdmClient *client, |
1167 | +- GError *error) |
1168 | +-{ |
1169 | +- GList *node; |
1170 | +- |
1171 | +- for (node = client->priv->pending_opens; |
1172 | +- node != NULL; |
1173 | +- node = node->next) { |
1174 | +- |
1175 | +- GTask *task = node->data; |
1176 | +- |
1177 | +- g_task_return_error (task, error); |
1178 | +- g_object_unref (task); |
1179 | +- } |
1180 | +- g_clear_pointer (&client->priv->pending_opens, |
1181 | +- (GDestroyNotify) g_list_free); |
1182 | +-} |
1183 | +- |
1184 | + static gboolean |
1185 | + gdm_client_open_connection_finish (GdmClient *client, |
1186 | + GAsyncResult *result, |
1187 | +@@ -581,7 +558,6 @@ gdm_client_open_connection_finish (GdmClient *client, |
1188 | + |
1189 | + connection = g_task_propagate_pointer (G_TASK (result), error); |
1190 | + if (connection == NULL) { |
1191 | +- finish_pending_opens (client, *error); |
1192 | + return FALSE; |
1193 | + } |
1194 | + |
1195 | +@@ -593,7 +569,6 @@ gdm_client_open_connection_finish (GdmClient *client, |
1196 | + connection = NULL; |
1197 | + } |
1198 | + |
1199 | +- finish_pending_opens (client, NULL); |
1200 | + return TRUE; |
1201 | + } |
1202 | + |
1203 | +@@ -620,17 +595,11 @@ gdm_client_open_connection (GdmClient *client, |
1204 | + return; |
1205 | + } |
1206 | + |
1207 | +- if (client->priv->pending_opens == NULL) { |
1208 | +- get_manager (client, |
1209 | +- cancellable, |
1210 | +- (GAsyncReadyCallback) |
1211 | +- on_got_manager_for_opening_connection, |
1212 | +- task); |
1213 | +- } else { |
1214 | +- client->priv->pending_opens = g_list_prepend (client->priv->pending_opens, |
1215 | +- task); |
1216 | +- } |
1217 | +- |
1218 | ++ get_manager (client, |
1219 | ++ cancellable, |
1220 | ++ (GAsyncReadyCallback) |
1221 | ++ on_got_manager_for_opening_connection, |
1222 | ++ task); |
1223 | + } |
1224 | + |
1225 | + /** |
1226 | diff --git a/debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch b/debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch |
1227 | new file mode 100644 |
1228 | index 0000000..ec25931 |
1229 | --- /dev/null |
1230 | +++ b/debian/patches/libgdm-fix-pointer-boolean-task-confusion.patch |
1231 | @@ -0,0 +1,47 @@ |
1232 | +From: Ray Strode <rstrode@redhat.com> |
1233 | +Date: Mon, 14 May 2018 15:49:50 -0400 |
1234 | +Subject: libgdm: fix pointer/boolean task confusion |
1235 | + |
1236 | +The manager fetching code in GdmClient treats its task |
1237 | +return value as boolean, but it's actually a pointer (the manager) |
1238 | + |
1239 | +This commit corrects the confusion. |
1240 | + |
1241 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
1242 | +--- |
1243 | + libgdm/gdm-client.c | 8 ++++++-- |
1244 | + 1 file changed, 6 insertions(+), 2 deletions(-) |
1245 | + |
1246 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
1247 | +index a88a5d7..06dfe72 100644 |
1248 | +--- a/libgdm/gdm-client.c |
1249 | ++++ b/libgdm/gdm-client.c |
1250 | +@@ -390,11 +390,13 @@ on_got_manager_for_reauthentication (GdmClient *client, |
1251 | + GTask *task) |
1252 | + { |
1253 | + GCancellable *cancellable; |
1254 | ++ GdmManager *manager; |
1255 | + char *username; |
1256 | + GError *error; |
1257 | + |
1258 | + error = NULL; |
1259 | +- if (!g_task_propagate_boolean (G_TASK (result), &error)) { |
1260 | ++ manager = g_task_propagate_pointer (G_TASK (result), &error); |
1261 | ++ if (manager == NULL) { |
1262 | + g_task_return_error (task, error); |
1263 | + g_object_unref (task); |
1264 | + return; |
1265 | +@@ -530,10 +532,12 @@ on_got_manager_for_opening_connection (GdmClient *client, |
1266 | + GTask *task) |
1267 | + { |
1268 | + GCancellable *cancellable; |
1269 | ++ GdmManager *manager; |
1270 | + GError *error; |
1271 | + |
1272 | + error = NULL; |
1273 | +- if (!g_task_propagate_boolean (G_TASK (result), &error)) { |
1274 | ++ manager = g_task_propagate_pointer (G_TASK (result), &error); |
1275 | ++ if (manager == NULL) { |
1276 | + g_task_return_error (task, error); |
1277 | + g_object_unref (task); |
1278 | + return; |
1279 | diff --git a/debian/patches/libgdm-get-connection-explicitly.patch b/debian/patches/libgdm-get-connection-explicitly.patch |
1280 | new file mode 100644 |
1281 | index 0000000..0b83eca |
1282 | --- /dev/null |
1283 | +++ b/debian/patches/libgdm-get-connection-explicitly.patch |
1284 | @@ -0,0 +1,393 @@ |
1285 | +From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net> |
1286 | +Date: Mon, 14 May 2018 22:32:25 +0200 |
1287 | +Subject: libgdm: get connection explicitly |
1288 | + |
1289 | +At the moment we call gdm_client_open_connection and when it finishes, |
1290 | +assume client->priv->connection is implicitly initialized. |
1291 | + |
1292 | +This commit makes the operation more explicit by changing |
1293 | +gdm_client_open_connection to gdm_client_get_connection and returning |
1294 | +the GDBusConnection object directly, instead of returning a boolean. |
1295 | + |
1296 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
1297 | +--- |
1298 | + libgdm/gdm-client.c | 136 +++++++++++++++++++++++++++++++--------------------- |
1299 | + 1 file changed, 82 insertions(+), 54 deletions(-) |
1300 | + |
1301 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
1302 | +index e02e3ea..e7b93e3 100644 |
1303 | +--- a/libgdm/gdm-client.c |
1304 | ++++ b/libgdm/gdm-client.c |
1305 | +@@ -393,10 +393,10 @@ on_got_manager_for_reauthentication (GdmClient *client, |
1306 | + |
1307 | + } |
1308 | + |
1309 | +-static gboolean |
1310 | +-gdm_client_open_connection_sync (GdmClient *client, |
1311 | +- GCancellable *cancellable, |
1312 | +- GError **error) |
1313 | ++static GDBusConnection * |
1314 | ++gdm_client_get_connection_sync (GdmClient *client, |
1315 | ++ GCancellable *cancellable, |
1316 | ++ GError **error) |
1317 | + { |
1318 | + g_autoptr(GdmManager) manager = NULL; |
1319 | + gboolean ret; |
1320 | +@@ -404,8 +404,7 @@ gdm_client_open_connection_sync (GdmClient *client, |
1321 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
1322 | + |
1323 | + if (client->priv->connection != NULL) { |
1324 | +- g_object_ref (client->priv->connection); |
1325 | +- return TRUE; |
1326 | ++ return g_object_ref (client->priv->connection); |
1327 | + } |
1328 | + |
1329 | + manager = gdm_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, |
1330 | +@@ -446,7 +445,7 @@ gdm_client_open_connection_sync (GdmClient *client, |
1331 | + &client->priv->connection); |
1332 | + |
1333 | + out: |
1334 | +- return client->priv->connection != NULL; |
1335 | ++ return client->priv->connection; |
1336 | + } |
1337 | + |
1338 | + static void |
1339 | +@@ -530,33 +529,31 @@ on_got_manager_for_opening_connection (GdmClient *client, |
1340 | + task); |
1341 | + } |
1342 | + |
1343 | +-static gboolean |
1344 | +-gdm_client_open_connection_finish (GdmClient *client, |
1345 | +- GAsyncResult *result, |
1346 | +- GError **error) |
1347 | ++static GDBusConnection * |
1348 | ++gdm_client_get_connection_finish (GdmClient *client, |
1349 | ++ GAsyncResult *result, |
1350 | ++ GError **error) |
1351 | + { |
1352 | +- g_autoptr(GDBusConnection) connection = NULL; |
1353 | ++ GDBusConnection *connection = NULL; |
1354 | + |
1355 | + g_return_val_if_fail (GDM_IS_CLIENT (client), FALSE); |
1356 | + |
1357 | + connection = g_task_propagate_pointer (G_TASK (result), error); |
1358 | + if (connection == NULL) { |
1359 | +- return FALSE; |
1360 | ++ return NULL; |
1361 | + } |
1362 | + |
1363 | + if (client->priv->connection == NULL) { |
1364 | +- client->priv->connection = g_steal_pointer (&connection); |
1365 | ++ client->priv->connection = connection; |
1366 | + g_object_add_weak_pointer (G_OBJECT (client->priv->connection), |
1367 | + (gpointer *) &client->priv->connection); |
1368 | +- } else if (client->priv->connection == connection) { |
1369 | +- connection = NULL; |
1370 | + } |
1371 | + |
1372 | +- return TRUE; |
1373 | ++ return g_object_ref (connection); |
1374 | + } |
1375 | + |
1376 | + static void |
1377 | +-gdm_client_open_connection (GdmClient *client, |
1378 | ++gdm_client_get_connection (GdmClient *client, |
1379 | + GCancellable *cancellable, |
1380 | + GAsyncReadyCallback callback, |
1381 | + gpointer user_data) |
1382 | +@@ -743,15 +740,19 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
1383 | + GCancellable *cancellable, |
1384 | + GError **error) |
1385 | + { |
1386 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1387 | ++ |
1388 | + if (client->priv->user_verifier != NULL) { |
1389 | + return g_object_ref (client->priv->user_verifier); |
1390 | + } |
1391 | + |
1392 | +- if (!gdm_client_open_connection_sync (client, cancellable, error)) { |
1393 | ++ connection = gdm_client_get_connection_sync (client, cancellable, error); |
1394 | ++ |
1395 | ++ if (connection == NULL) { |
1396 | + return NULL; |
1397 | + } |
1398 | + |
1399 | +- client->priv->user_verifier = gdm_user_verifier_proxy_new_sync (client->priv->connection, |
1400 | ++ client->priv->user_verifier = gdm_user_verifier_proxy_new_sync (connection, |
1401 | + G_DBUS_PROXY_FLAGS_NONE, |
1402 | + NULL, |
1403 | + SESSION_DBUS_PATH, |
1404 | +@@ -762,6 +763,7 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
1405 | + g_object_add_weak_pointer (G_OBJECT (client->priv->user_verifier), |
1406 | + (gpointer *) |
1407 | + &client->priv->user_verifier); |
1408 | ++ g_object_ref (connection); |
1409 | + g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
1410 | + (GWeakNotify) |
1411 | + g_object_unref, |
1412 | +@@ -805,22 +807,25 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
1413 | + } |
1414 | + |
1415 | + static void |
1416 | +-on_connection_opened_for_user_verifier (GdmClient *client, |
1417 | +- GAsyncResult *result, |
1418 | +- GTask *task) |
1419 | ++on_connection_for_user_verifier (GdmClient *client, |
1420 | ++ GAsyncResult *result, |
1421 | ++ GTask *task) |
1422 | + { |
1423 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1424 | + GCancellable *cancellable; |
1425 | + GError *error; |
1426 | + |
1427 | + error = NULL; |
1428 | +- if (!gdm_client_open_connection_finish (client, result, &error)) { |
1429 | ++ connection = gdm_client_get_connection_finish (client, result, &error); |
1430 | ++ |
1431 | ++ if (connection == NULL) { |
1432 | + g_task_return_error (task, error); |
1433 | + g_object_unref (task); |
1434 | + return; |
1435 | + } |
1436 | + |
1437 | + cancellable = g_task_get_cancellable (task); |
1438 | +- gdm_user_verifier_proxy_new (client->priv->connection, |
1439 | ++ gdm_user_verifier_proxy_new (connection, |
1440 | + G_DBUS_PROXY_FLAGS_NONE, |
1441 | + NULL, |
1442 | + SESSION_DBUS_PATH, |
1443 | +@@ -863,10 +868,10 @@ gdm_client_get_user_verifier (GdmClient *client, |
1444 | + return; |
1445 | + } |
1446 | + |
1447 | +- gdm_client_open_connection (client, |
1448 | ++ gdm_client_get_connection (client, |
1449 | + cancellable, |
1450 | + (GAsyncReadyCallback) |
1451 | +- on_connection_opened_for_user_verifier, |
1452 | ++ on_connection_for_user_verifier, |
1453 | + task); |
1454 | + } |
1455 | + |
1456 | +@@ -975,22 +980,25 @@ on_greeter_proxy_created (GObject *source, |
1457 | + } |
1458 | + |
1459 | + static void |
1460 | +-on_connection_opened_for_greeter (GdmClient *client, |
1461 | +- GAsyncResult *result, |
1462 | +- GTask *task) |
1463 | ++on_connection_for_greeter (GdmClient *client, |
1464 | ++ GAsyncResult *result, |
1465 | ++ GTask *task) |
1466 | + { |
1467 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1468 | + GCancellable *cancellable; |
1469 | + GError *error; |
1470 | + |
1471 | + error = NULL; |
1472 | +- if (!gdm_client_open_connection_finish (client, result, &error)) { |
1473 | ++ connection = gdm_client_get_connection_finish (client, result, &error); |
1474 | ++ |
1475 | ++ if (connection == NULL) { |
1476 | + g_task_return_error (task, error); |
1477 | + g_object_unref (task); |
1478 | + return; |
1479 | + } |
1480 | + |
1481 | + cancellable = g_task_get_cancellable (task); |
1482 | +- gdm_greeter_proxy_new (client->priv->connection, |
1483 | ++ gdm_greeter_proxy_new (connection, |
1484 | + G_DBUS_PROXY_FLAGS_NONE, |
1485 | + NULL, |
1486 | + SESSION_DBUS_PATH, |
1487 | +@@ -1033,10 +1041,10 @@ gdm_client_get_greeter (GdmClient *client, |
1488 | + return; |
1489 | + } |
1490 | + |
1491 | +- gdm_client_open_connection (client, |
1492 | ++ gdm_client_get_connection (client, |
1493 | + cancellable, |
1494 | + (GAsyncReadyCallback) |
1495 | +- on_connection_opened_for_greeter, |
1496 | ++ on_connection_for_greeter, |
1497 | + task); |
1498 | + } |
1499 | + |
1500 | +@@ -1098,15 +1106,19 @@ gdm_client_get_greeter_sync (GdmClient *client, |
1501 | + GCancellable *cancellable, |
1502 | + GError **error) |
1503 | + { |
1504 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1505 | ++ |
1506 | + if (client->priv->greeter != NULL) { |
1507 | + return g_object_ref (client->priv->greeter); |
1508 | + } |
1509 | + |
1510 | +- if (!gdm_client_open_connection_sync (client, cancellable, error)) { |
1511 | ++ connection = gdm_client_get_connection_sync (client, cancellable, error); |
1512 | ++ |
1513 | ++ if (connection == NULL) { |
1514 | + return NULL; |
1515 | + } |
1516 | + |
1517 | +- client->priv->greeter = gdm_greeter_proxy_new_sync (client->priv->connection, |
1518 | ++ client->priv->greeter = gdm_greeter_proxy_new_sync (connection, |
1519 | + G_DBUS_PROXY_FLAGS_NONE, |
1520 | + NULL, |
1521 | + SESSION_DBUS_PATH, |
1522 | +@@ -1150,22 +1162,25 @@ on_remote_greeter_proxy_created (GObject *object, |
1523 | + } |
1524 | + |
1525 | + static void |
1526 | +-on_connection_opened_for_remote_greeter (GdmClient *client, |
1527 | +- GAsyncResult *result, |
1528 | +- GTask *task) |
1529 | ++on_connection_for_remote_greeter (GdmClient *client, |
1530 | ++ GAsyncResult *result, |
1531 | ++ GTask *task) |
1532 | + { |
1533 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1534 | + GCancellable *cancellable; |
1535 | + GError *error; |
1536 | + |
1537 | + error = NULL; |
1538 | +- if (!gdm_client_open_connection_finish (client, result, &error)) { |
1539 | ++ connection = gdm_client_get_connection_finish (client, result, &error); |
1540 | ++ |
1541 | ++ if (connection == NULL) { |
1542 | + g_task_return_error (task, error); |
1543 | + g_object_unref (task); |
1544 | + return; |
1545 | + } |
1546 | + |
1547 | + cancellable = g_task_get_cancellable (task); |
1548 | +- gdm_remote_greeter_proxy_new (client->priv->connection, |
1549 | ++ gdm_remote_greeter_proxy_new (connection, |
1550 | + G_DBUS_PROXY_FLAGS_NONE, |
1551 | + NULL, |
1552 | + SESSION_DBUS_PATH, |
1553 | +@@ -1208,10 +1223,10 @@ gdm_client_get_remote_greeter (GdmClient *client, |
1554 | + return; |
1555 | + } |
1556 | + |
1557 | +- gdm_client_open_connection (client, |
1558 | ++ gdm_client_get_connection (client, |
1559 | + cancellable, |
1560 | + (GAsyncReadyCallback) |
1561 | +- on_connection_opened_for_remote_greeter, |
1562 | ++ on_connection_for_remote_greeter, |
1563 | + task); |
1564 | + } |
1565 | + |
1566 | +@@ -1273,15 +1288,19 @@ gdm_client_get_remote_greeter_sync (GdmClient *client, |
1567 | + GCancellable *cancellable, |
1568 | + GError **error) |
1569 | + { |
1570 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1571 | ++ |
1572 | + if (client->priv->remote_greeter != NULL) { |
1573 | + return g_object_ref (client->priv->remote_greeter); |
1574 | + } |
1575 | + |
1576 | +- if (!gdm_client_open_connection_sync (client, cancellable, error)) { |
1577 | ++ connection = gdm_client_get_connection_sync (client, cancellable, error); |
1578 | ++ |
1579 | ++ if (connection == NULL) { |
1580 | + return NULL; |
1581 | + } |
1582 | + |
1583 | +- client->priv->remote_greeter = gdm_remote_greeter_proxy_new_sync (client->priv->connection, |
1584 | ++ client->priv->remote_greeter = gdm_remote_greeter_proxy_new_sync (connection, |
1585 | + G_DBUS_PROXY_FLAGS_NONE, |
1586 | + NULL, |
1587 | + SESSION_DBUS_PATH, |
1588 | +@@ -1292,6 +1311,7 @@ gdm_client_get_remote_greeter_sync (GdmClient *client, |
1589 | + g_object_add_weak_pointer (G_OBJECT (client->priv->remote_greeter), |
1590 | + (gpointer *) |
1591 | + &client->priv->remote_greeter); |
1592 | ++ g_object_ref (connection); |
1593 | + g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
1594 | + (GWeakNotify) |
1595 | + g_object_unref, |
1596 | +@@ -1323,22 +1343,25 @@ on_chooser_proxy_created (GObject *source, |
1597 | + } |
1598 | + |
1599 | + static void |
1600 | +-on_connection_opened_for_chooser (GdmClient *client, |
1601 | +- GAsyncResult *result, |
1602 | +- GTask *task) |
1603 | ++on_connection_for_chooser (GdmClient *client, |
1604 | ++ GAsyncResult *result, |
1605 | ++ GTask *task) |
1606 | + { |
1607 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1608 | + GCancellable *cancellable; |
1609 | + GError *error; |
1610 | + |
1611 | + error = NULL; |
1612 | +- if (!gdm_client_open_connection_finish (client, result, &error)) { |
1613 | ++ connection = gdm_client_get_connection_finish (client, result, &error); |
1614 | ++ |
1615 | ++ if (connection == NULL) { |
1616 | + g_task_return_error (task, error); |
1617 | + g_object_unref (task); |
1618 | + return; |
1619 | + } |
1620 | + |
1621 | + cancellable = g_task_get_cancellable (task); |
1622 | +- gdm_chooser_proxy_new (client->priv->connection, |
1623 | ++ gdm_chooser_proxy_new (connection, |
1624 | + G_DBUS_PROXY_FLAGS_NONE, |
1625 | + NULL, |
1626 | + SESSION_DBUS_PATH, |
1627 | +@@ -1381,10 +1404,10 @@ gdm_client_get_chooser (GdmClient *client, |
1628 | + return; |
1629 | + } |
1630 | + |
1631 | +- gdm_client_open_connection (client, |
1632 | ++ gdm_client_get_connection (client, |
1633 | + cancellable, |
1634 | + (GAsyncReadyCallback) |
1635 | +- on_connection_opened_for_chooser, |
1636 | ++ on_connection_for_chooser, |
1637 | + task); |
1638 | + } |
1639 | + |
1640 | +@@ -1421,6 +1444,7 @@ gdm_client_get_chooser_finish (GdmClient *client, |
1641 | + (gpointer *) |
1642 | + &client->priv->chooser); |
1643 | + |
1644 | ++ g_object_ref (connection); |
1645 | + g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1646 | + (GWeakNotify) |
1647 | + g_object_unref, |
1648 | +@@ -1446,16 +1470,19 @@ gdm_client_get_chooser_sync (GdmClient *client, |
1649 | + GCancellable *cancellable, |
1650 | + GError **error) |
1651 | + { |
1652 | ++ g_autoptr(GDBusConnection) connection = NULL; |
1653 | + |
1654 | + if (client->priv->chooser != NULL) { |
1655 | + return g_object_ref (client->priv->chooser); |
1656 | + } |
1657 | + |
1658 | +- if (!gdm_client_open_connection_sync (client, cancellable, error)) { |
1659 | ++ connection = gdm_client_get_connection_sync (client, cancellable, error); |
1660 | ++ |
1661 | ++ if (connection == NULL) { |
1662 | + return NULL; |
1663 | + } |
1664 | + |
1665 | +- client->priv->chooser = gdm_chooser_proxy_new_sync (client->priv->connection, |
1666 | ++ client->priv->chooser = gdm_chooser_proxy_new_sync (connection, |
1667 | + G_DBUS_PROXY_FLAGS_NONE, |
1668 | + NULL, |
1669 | + SESSION_DBUS_PATH, |
1670 | +@@ -1466,6 +1493,7 @@ gdm_client_get_chooser_sync (GdmClient *client, |
1671 | + g_object_add_weak_pointer (G_OBJECT (client->priv->chooser), |
1672 | + (gpointer *) |
1673 | + &client->priv->chooser); |
1674 | ++ g_object_ref (connection); |
1675 | + g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1676 | + (GWeakNotify) |
1677 | + g_object_unref, |
1678 | diff --git a/debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch b/debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch |
1679 | new file mode 100644 |
1680 | index 0000000..6ee12ee |
1681 | --- /dev/null |
1682 | +++ b/debian/patches/libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch |
1683 | @@ -0,0 +1,64 @@ |
1684 | +From: Ray Strode <rstrode@redhat.com> |
1685 | +Date: Tue, 15 May 2018 23:02:36 +0200 |
1686 | +Subject: libgdm: use g_object_unref instead of g_clear_object for weakrefs |
1687 | + |
1688 | +At the moment we add a weakref on each proxy to the connection |
1689 | +object. For the _sync variant functions, When the weakref fires, |
1690 | +they call g_clear_object, clearing the connection, even if other |
1691 | +proxies still have a reference. |
1692 | + |
1693 | +This commit changes that weak ref code to use g_object_unref instead. |
1694 | + |
1695 | +https://bugzilla.gnome.org/show_bug.cgi?id=795940 |
1696 | +--- |
1697 | + libgdm/gdm-client.c | 16 ++++++++-------- |
1698 | + 1 file changed, 8 insertions(+), 8 deletions(-) |
1699 | + |
1700 | +diff --git a/libgdm/gdm-client.c b/libgdm/gdm-client.c |
1701 | +index c34121e..e02e3ea 100644 |
1702 | +--- a/libgdm/gdm-client.c |
1703 | ++++ b/libgdm/gdm-client.c |
1704 | +@@ -764,8 +764,8 @@ gdm_client_get_user_verifier_sync (GdmClient *client, |
1705 | + &client->priv->user_verifier); |
1706 | + g_object_weak_ref (G_OBJECT (client->priv->user_verifier), |
1707 | + (GWeakNotify) |
1708 | +- g_clear_object, |
1709 | +- &client->priv->connection); |
1710 | ++ g_object_unref, |
1711 | ++ client->priv->connection); |
1712 | + |
1713 | + if (client->priv->enabled_extensions != NULL) { |
1714 | + gboolean res; |
1715 | +@@ -1119,8 +1119,8 @@ gdm_client_get_greeter_sync (GdmClient *client, |
1716 | + &client->priv->greeter); |
1717 | + g_object_weak_ref (G_OBJECT (client->priv->greeter), |
1718 | + (GWeakNotify) |
1719 | +- g_clear_object, |
1720 | +- &client->priv->connection); |
1721 | ++ g_object_unref, |
1722 | ++ client->priv->connection); |
1723 | + |
1724 | + query_for_timed_login_requested_signal (client->priv->greeter); |
1725 | + } |
1726 | +@@ -1294,8 +1294,8 @@ gdm_client_get_remote_greeter_sync (GdmClient *client, |
1727 | + &client->priv->remote_greeter); |
1728 | + g_object_weak_ref (G_OBJECT (client->priv->remote_greeter), |
1729 | + (GWeakNotify) |
1730 | +- g_clear_object, |
1731 | +- &client->priv->connection); |
1732 | ++ g_object_unref, |
1733 | ++ client->priv->connection); |
1734 | + } |
1735 | + |
1736 | + return client->priv->remote_greeter; |
1737 | +@@ -1468,8 +1468,8 @@ gdm_client_get_chooser_sync (GdmClient *client, |
1738 | + &client->priv->chooser); |
1739 | + g_object_weak_ref (G_OBJECT (client->priv->chooser), |
1740 | + (GWeakNotify) |
1741 | +- g_clear_object, |
1742 | +- &client->priv->connection); |
1743 | ++ g_object_unref, |
1744 | ++ client->priv->connection); |
1745 | + } |
1746 | + |
1747 | + return client->priv->chooser; |
1748 | diff --git a/debian/patches/series b/debian/patches/series |
1749 | index 8a5cba3..2b1f6c0 100644 |
1750 | --- a/debian/patches/series |
1751 | +++ b/debian/patches/series |
1752 | @@ -1,3 +1,16 @@ |
1753 | +libgdm-drop-support-for-serializing-multiple-opens.patch |
1754 | +libgdm-fix-pointer-boolean-task-confusion.patch |
1755 | +libgdm-don-t-keep-manager-proxy-around-longer-than-we-nee.patch |
1756 | +libgdm-use-g_object_unref-instead-of-g_clear_object-for-w.patch |
1757 | +libgdm-get-connection-explicitly.patch |
1758 | +libgdm-Drop-weak-refs-on-the-GDBusConnection.patch |
1759 | +libgdm-Unref-the-manager-propagated-from-task.patch |
1760 | +libgdm-Don-t-double-ref-the-connection-got-from-task.patch |
1761 | +libgdm-Don-t-leak-connection-on-sync-re-authentication.patch |
1762 | +libgdm-Use-auto-pointers-and-cleanup-code.patch |
1763 | +libgdb-Try-to-reuse-connections-from-the-available-proxie.patch |
1764 | +libgdm-Don-t-save-manager-address.patch |
1765 | +libgdm-Return-NULL-on-invalid-client-instances.patch |
1766 | 16_xserver_path.patch |
1767 | 90_config_comments.patch |
1768 | 91_dconf_database_path.patch |
merci!