]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Fix invalid unref when fail to start seat. Add regression test for this case
authorRobert Ancell <robert.ancell@canonical.com>
Wed, 1 Jun 2016 00:07:33 +0000 (12:07 +1200)
committerRobert Ancell <robert.ancell@canonical.com>
Wed, 1 Jun 2016 00:07:33 +0000 (12:07 +1200)
src/lightdm.c
tests/Makefile.am
tests/scripts/invalid-seat.conf [new file with mode: 0644]
tests/test-invalid-seat [new file with mode: 0755]

index 32ab3c05e231417609a9fd57a928b41b71940db4..714f86fc33c92775114fc2507ef0f62423c804e2 100644 (file)
@@ -1038,15 +1038,14 @@ add_login1_seat (Login1Seat *login1_seat)
             seat_set_property (seat, "exit-on-failure", "true");
     }
     else
-        g_debug ("Unable to create seat: %s", seat_name);
-
-    if (seat)
     {
-        started = display_manager_add_seat (display_manager, seat);
-        if (!started)
-            g_debug ("Failed to start seat: %s", seat_name);
+        g_debug ("Unable to create seat: %s", seat_name);
+        return FALSE;
     }
 
+    started = display_manager_add_seat (display_manager, seat);
+    if (!started)
+        g_debug ("Failed to start seat: %s", seat_name);
     g_object_unref (seat);
 
     return started;
index 1e55a588440e498c0d06489c1c4caa60e5788118..866f46a714f26ce3332516b6ecdf756e4b44ab10 100644 (file)
@@ -249,6 +249,7 @@ TESTS = \
        test-unity-mir-switch \
        test-unity-mir-switch-to-user-resettable \
        test-unity-mir-script-hooks \
+       test-invalid-seat \
        test-seatdefaults-still-supported
 
 #      test-mir-script-hooks \
@@ -447,6 +448,7 @@ EXTRA_DIST = \
        scripts/headless.conf \
        scripts/home-dir-on-authenticate.conf \
        scripts/home-dir-on-session.conf \
+       scripts/invalid-seat.conf \
        scripts/language.conf \
        scripts/language-env.conf \
        scripts/language-no-accounts-service.conf \
diff --git a/tests/scripts/invalid-seat.conf b/tests/scripts/invalid-seat.conf
new file mode 100644 (file)
index 0000000..1be78f4
--- /dev/null
@@ -0,0 +1,14 @@
+#
+# Check stops on an unknown seat type
+#
+
+[Seat:*]
+type=invalid
+autologin-user=have-password1
+user-session=default
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# Can't start an unknown seat
+#?RUNNER DAEMON-EXIT STATUS=1
diff --git a/tests/test-invalid-seat b/tests/test-invalid-seat
new file mode 100755 (executable)
index 0000000..31d79d8
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner invalid-seat test-gobject-greeter