Merge lp:~robert-ancell/unity-greeter/kill-init into lp:unity-greeter

Proposed by Robert Ancell
Status: Merged
Merged at revision: 1202
Proposed branch: lp:~robert-ancell/unity-greeter/kill-init
Merge into: lp:unity-greeter
Diff against target: 80 lines (+20/-8)
2 files modified
src/menubar.vala (+1/-1)
src/unity-greeter.vala (+19/-7)
To merge this branch: bzr merge lp:~robert-ancell/unity-greeter/kill-init
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Robert Ancell Approve
Review via email: mp+214657@code.launchpad.net

Commit message

Correctly handle SIGTERM and quit cleanly. We were previously not stopping the signal and so not cleaning up on exit. This left an upstart process for each greeter remaining.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/menubar.vala'
2--- src/menubar.vala 2014-03-26 20:59:31 +0000
3+++ src/menubar.vala 2014-04-08 03:49:45 +0000
4@@ -158,7 +158,7 @@
5
6 private void close_pid (ref Pid pid)
7 {
8- if (pid != 0)
9+ if (pid > 0)
10 {
11 Posix.kill (pid, Posix.SIGTERM);
12 int status;
13
14=== modified file 'src/unity-greeter.vala'
15--- src/unity-greeter.vala 2014-04-08 01:52:27 +0000
16+++ src/unity-greeter.vala 2014-04-08 03:49:45 +0000
17@@ -468,7 +468,7 @@
18 Environment.set_variable ("GTK_MODULES", "atk-bridge", false);
19
20 Pid atspi_pid = 0;
21- Pid indicator_pid = 0;
22+ Pid upstart_pid = 0;
23
24 try
25 {
26@@ -580,7 +580,7 @@
27 null,
28 SpawnFlags.SEARCH_PATH,
29 null,
30- out indicator_pid);
31+ out upstart_pid);
32 }
33 catch (Error e)
34 {
35@@ -604,18 +604,24 @@
36 GLib.Unix.signal_add(GLib.ProcessSignal.TERM, () => {
37 debug("Got a SIGTERM");
38 Gtk.main_quit();
39- return false;
40+ return true;
41 });
42
43 debug ("Starting main loop");
44 Gtk.main ();
45
46- if (indicator_pid != 0)
47+ debug ("Cleaning up");
48+
49+ if (upstart_pid != 0)
50 {
51- Posix.kill (indicator_pid, Posix.SIGTERM);
52+ Posix.kill (upstart_pid, Posix.SIGTERM);
53 int status;
54- Posix.waitpid (indicator_pid, out status, 0);
55- indicator_pid = 0;
56+ Posix.waitpid (upstart_pid, out status, 0);
57+ if (Process.if_exited (status))
58+ debug ("Upstart exited with return value %d", Process.exit_status (status));
59+ else
60+ debug ("Upstart terminated with signal %d", Process.term_sig (status));
61+ upstart_pid = 0;
62 }
63
64 if (atspi_pid != 0)
65@@ -623,9 +629,15 @@
66 Posix.kill (atspi_pid, Posix.SIGKILL);
67 int status;
68 Posix.waitpid (atspi_pid, out status, 0);
69+ if (Process.if_exited (status))
70+ debug ("AT-SPI exited with return value %d", Process.exit_status (status));
71+ else
72+ debug ("AT-SPI terminated with signal %d", Process.term_sig (status));
73 atspi_pid = 0;
74 }
75
76+ debug ("Exiting");
77+
78 return Posix.EXIT_SUCCESS;
79 }
80 }

Subscribers

People subscribed via source and target branches