aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-11-12 17:30:15 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-11-12 17:30:15 -0600
commit8709a6ca1c048401486a632f5a6b343a9c59b313 (patch)
tree8b0514e92eb3d0d76ab395a55931828269e028a5 /src
parent5191f0e8e414d9542b77eaed253a28c7919b1b8b (diff)
downloadayatana-indicator-session-8709a6ca1c048401486a632f5a6b343a9c59b313.tar.gz
ayatana-indicator-session-8709a6ca1c048401486a632f5a6b343a9c59b313.tar.bz2
ayatana-indicator-session-8709a6ca1c048401486a632f5a6b343a9c59b313.zip
in user-service-dbus.c, don't crash if getting a display proxy fails.
Diffstat (limited to 'src')
-rw-r--r--src/users-service-dbus.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index fec17dc..f12f47c 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -927,11 +927,16 @@ users_service_dbus_get_user_list (UsersServiceDbus * self)
void
users_service_dbus_show_greeter (UsersServiceDbus * self)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -942,11 +947,16 @@ users_service_dbus_show_greeter (UsersServiceDbus * self)
void
users_service_dbus_activate_guest_session (UsersServiceDbus * self)
{
- g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
+ DisplayManagerSeat * dp;
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
- g_clear_object (&dp);
+ g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -958,12 +968,17 @@ void
users_service_dbus_activate_user_session (UsersServiceDbus * self,
AccountsUser * user)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- const char * const username = accounts_user_get_user_name (user);
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ const char * const username = accounts_user_get_user_name (user);
+ display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -974,11 +989,18 @@ users_service_dbus_activate_user_session (UsersServiceDbus * self,
gboolean
users_service_dbus_guest_session_enabled (UsersServiceDbus * self)
{
- g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
+ DisplayManagerSeat * dp;
+ gboolean enabled = FALSE;
+
+ g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), enabled);
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ enabled = display_manager_seat_get_has_guest_account (dp);
+ g_clear_object (&dp);
+ }
- DisplayManagerSeat * dp = create_display_proxy (self);
- const gboolean enabled = display_manager_seat_get_has_guest_account (dp);
- g_clear_object (&dp);
return enabled;
}