Merge lp:~charlesk/indicator-session/lp-1078119 into lp:indicator-session/13.04

Proposed by Charles Kerr
Status: Merged
Approved by: Charles Kerr
Approved revision: 372
Merged at revision: 372
Proposed branch: lp:~charlesk/indicator-session/lp-1078119
Merge into: lp:indicator-session/13.04
Diff against target: 90 lines (+39/-17)
1 file modified
src/users-service-dbus.c (+39/-17)
To merge this branch: bzr merge lp:~charlesk/indicator-session/lp-1078119
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+134006@code.launchpad.net

Commit message

In users-service-dbus.c, check to make sure that create_display_proxy() succeeded before using the proxy pointer that gets returned.

Description of the change

In users-service-dbus.c, check to make sure that create_display_proxy() succeeded before using the proxy pointer that gets returned.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

Good catch! Doubly so if it fixes the Jenkins issue from last week.

Just one thing I noticed in passing: accounts_user_proxy_get_user_name returns a `const gchar *` it got from a variant that it doesn't hold a reference to anymore. It happens to work because the variant stays alive inside the GDBusProxy.

review: Approve
Revision history for this message
Charles Kerr (charlesk) wrote :

Hmm, that's in the autogenerated code. I don't see any way around that other than just to avoid that function & use the ..._dup_user_name() version instead?

This same issue happens for accounts_user_proxy_get_real_name(), accounts_user_proxy_get_home_directory()... really any string property.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/users-service-dbus.c'
2--- src/users-service-dbus.c 2012-07-06 21:55:41 +0000
3+++ src/users-service-dbus.c 2012-11-12 23:33:23 +0000
4@@ -927,11 +927,16 @@
5 void
6 users_service_dbus_show_greeter (UsersServiceDbus * self)
7 {
8+ DisplayManagerSeat * dp;
9+
10 g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
11
12- DisplayManagerSeat * dp = create_display_proxy (self);
13- display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
14- g_clear_object (&dp);
15+ dp = create_display_proxy (self);
16+ if (dp != NULL)
17+ {
18+ display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
19+ g_clear_object (&dp);
20+ }
21 }
22
23 /**
24@@ -942,11 +947,16 @@
25 void
26 users_service_dbus_activate_guest_session (UsersServiceDbus * self)
27 {
28- g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
29-
30- DisplayManagerSeat * dp = create_display_proxy (self);
31- display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
32- g_clear_object (&dp);
33+ DisplayManagerSeat * dp;
34+
35+ g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
36+
37+ dp = create_display_proxy (self);
38+ if (dp != NULL)
39+ {
40+ display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
41+ g_clear_object (&dp);
42+ }
43 }
44
45 /**
46@@ -958,12 +968,17 @@
47 users_service_dbus_activate_user_session (UsersServiceDbus * self,
48 AccountsUser * user)
49 {
50+ DisplayManagerSeat * dp;
51+
52 g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
53
54- const char * const username = accounts_user_get_user_name (user);
55- DisplayManagerSeat * dp = create_display_proxy (self);
56- display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
57- g_clear_object (&dp);
58+ dp = create_display_proxy (self);
59+ if (dp != NULL)
60+ {
61+ const char * const username = accounts_user_get_user_name (user);
62+ display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
63+ g_clear_object (&dp);
64+ }
65 }
66
67 /**
68@@ -974,11 +989,18 @@
69 gboolean
70 users_service_dbus_guest_session_enabled (UsersServiceDbus * self)
71 {
72- g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
73-
74- DisplayManagerSeat * dp = create_display_proxy (self);
75- const gboolean enabled = display_manager_seat_get_has_guest_account (dp);
76- g_clear_object (&dp);
77+ DisplayManagerSeat * dp;
78+ gboolean enabled = FALSE;
79+
80+ g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), enabled);
81+
82+ dp = create_display_proxy (self);
83+ if (dp != NULL)
84+ {
85+ enabled = display_manager_seat_get_has_guest_account (dp);
86+ g_clear_object (&dp);
87+ }
88+
89 return enabled;
90 }
91

Subscribers

People subscribed via source and target branches