diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2014-12-08 11:37:28 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2014-12-08 11:37:28 +1300 |
commit | a0616a72a7490d31e8f9b7ccca6ac3b648ef405c (patch) | |
tree | 89353f0bf2e6f2a9a968c8793ea53e10ecc8dead /src/lightdm.c | |
parent | 1cd7849d1b670f95a9342df2b789312af73c7839 (diff) | |
download | lightdm-a0616a72a7490d31e8f9b7ccca6ac3b648ef405c.tar.gz |
Don't attempt generate D-Bus seat/session removal signals on shutdown.
This crashes on more recent versions of GLib.
Diffstat (limited to 'src/lightdm.c')
-rw-r--r-- | src/lightdm.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/src/lightdm.c b/src/lightdm.c index 886eae81..fdebd682 100644 --- a/src/lightdm.c +++ b/src/lightdm.c @@ -611,11 +611,6 @@ seat_bus_entry_free (gpointer data) { SeatBusEntry *entry = data; - g_dbus_connection_unregister_object (bus, entry->bus_id); - - emit_object_value_changed (bus, "/org/freedesktop/DisplayManager", "org.freedesktop.DisplayManager", "Seats", get_seat_list ()); - emit_object_signal (bus, "/org/freedesktop/DisplayManager", "SeatRemoved", entry->path); - g_free (entry->path); g_free (entry); } @@ -625,14 +620,6 @@ session_bus_entry_free (gpointer data) { SessionBusEntry *entry = data; - g_dbus_connection_unregister_object (bus, entry->bus_id); - - emit_object_value_changed (bus, "/org/freedesktop/DisplayManager", "org.freedesktop.DisplayManager", "Sessions", get_session_list (NULL)); - emit_object_signal (bus, "/org/freedesktop/DisplayManager", "SessionRemoved", entry->path); - - emit_object_value_changed (bus, entry->seat_path, "org.freedesktop.DisplayManager.Seat", "Sessions", get_session_list (entry->seat_path)); - emit_object_signal (bus, entry->seat_path, "SessionRemoved", entry->path); - g_free (entry->path); g_free (entry->seat_path); g_free (entry); @@ -685,8 +672,28 @@ running_user_session_cb (Seat *seat, Session *session) static void session_removed_cb (Seat *seat, Session *session) { + SessionBusEntry *entry; + gchar *seat_path = NULL; + g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat); + + entry = g_hash_table_lookup (session_bus_entries, session); + if (entry) + { + g_dbus_connection_unregister_object (bus, entry->bus_id); + emit_object_signal (bus, "/org/freedesktop/DisplayManager", "SessionRemoved", entry->path); + emit_object_signal (bus, entry->seat_path, "SessionRemoved", entry->path); + seat_path = g_strdup (entry->seat_path); + } + g_hash_table_remove (session_bus_entries, session); + + if (seat_path) + { + emit_object_value_changed (bus, "/org/freedesktop/DisplayManager", "org.freedesktop.DisplayManager", "Sessions", get_session_list (NULL)); + emit_object_value_changed (bus, seat_path, "org.freedesktop.DisplayManager.Seat", "Sessions", get_session_list (seat_path)); + g_free (seat_path); + } } static void @@ -730,7 +737,18 @@ seat_added_cb (DisplayManager *display_manager, Seat *seat) static void seat_removed_cb (DisplayManager *display_manager, Seat *seat) { + SeatBusEntry *entry; + + entry = g_hash_table_lookup (seat_bus_entries, seat); + if (entry) + { + g_dbus_connection_unregister_object (bus, entry->bus_id); + emit_object_signal (bus, "/org/freedesktop/DisplayManager", "SeatRemoved", entry->path); + } + g_hash_table_remove (seat_bus_entries, seat); + + emit_object_value_changed (bus, "/org/freedesktop/DisplayManager", "org.freedesktop.DisplayManager", "Seats", get_seat_list ()); } static gboolean |