chiark / gitweb /
update TODO
[elogind.git] / src / login / logind.c
index 48da7b173b4eccfa5af7f69470c67ac9d3079e4a..7aea3cdcb1eb645eaeb512089d3231a5e797bfff 100644 (file)
@@ -73,8 +73,7 @@ Manager *manager_new(void) {
         m->busnames = set_new(string_hash_func, string_compare_func);
 
         if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->busnames ||
-            !m->user_units || !m->session_units ||
-            !m->busnames) {
+            !m->user_units || !m->session_units) {
                 manager_free(m);
                 return NULL;
         }
@@ -862,7 +861,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
                 seat->in_gc_queue = false;
 
                 if (!seat_check_gc(seat, drop_not_started)) {
-                        seat_stop(seat);
+                        seat_stop(seat, false);
                         seat_free(seat);
                 }
         }
@@ -871,8 +870,15 @@ void manager_gc(Manager *m, bool drop_not_started) {
                 LIST_REMOVE(gc_queue, m->session_gc_queue, session);
                 session->in_gc_queue = false;
 
+                /* First, if we are not closing yet, initiate stopping */
+                if (!session_check_gc(session, drop_not_started) &&
+                    session_get_state(session) != SESSION_CLOSING)
+                        session_stop(session, false);
+
+                /* Normally, this should make the session busy again,
+                 * if it doesn't then let's get rid of it
+                 * immediately */
                 if (!session_check_gc(session, drop_not_started)) {
-                        session_stop(session);
                         session_finalize(session);
                         session_free(session);
                 }
@@ -882,8 +888,12 @@ void manager_gc(Manager *m, bool drop_not_started) {
                 LIST_REMOVE(gc_queue, m->user_gc_queue, user);
                 user->in_gc_queue = false;
 
+                /* First step: queue stop jobs */
+                if (!user_check_gc(user, drop_not_started))
+                        user_stop(user, false);
+
+                /* Second step: finalize user */
                 if (!user_check_gc(user, drop_not_started)) {
-                        user_stop(user);
                         user_finalize(user);
                         user_free(user);
                 }