Merge lp:~laney/whoopsie/source into lp:whoopsie

Proposed by Iain Lane
Status: Merged
Merged at revision: 639
Proposed branch: lp:~laney/whoopsie/source
Merge into: lp:whoopsie
Diff against target: 114 lines (+26/-9)
4 files modified
debian/changelog (+10/-0)
debian/control (+1/-1)
src/tests/test_monitor.c (+14/-7)
src/whoopsie.c (+1/-1)
To merge this branch: bzr merge lp:~laney/whoopsie/source
Reviewer Review Type Date Requested Status
Evan (community) Approve
Lars Karlitski (community) Approve
Review via email: mp+238539@code.launchpad.net

Description of the change

Use G_SOURCE_* macros for clarity

Don't call g_main_loop_quit as a GSourceFunc directly, it has the wrong return type. Need to remove the source explicitly.

To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

Looks good, thanks!

review: Approve
Revision history for this message
Evan (ev) wrote :

Thank you for this.

review: Approve
lp:~laney/whoopsie/source updated
641. By Iain Lane

releasing package whoopsie version 0.2.39

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-10-09 22:59:00 +0000
3+++ debian/changelog 2014-10-16 09:41:22 +0000
4@@ -1,3 +1,13 @@
5+whoopsie (0.2.39) UNRELEASED; urgency=medium
6+
7+ * Use G_SOURCE_CONTINUE and G_SOURCE_REMOVE for GSourceFunc return values,
8+ for clarity
9+ * tests/monitor: Call g_main_loop_quit from a callback function which
10+ removes the source instead of directly. GSourceFuncs need to return a
11+ boolean to say if they should be executed again or not. (LP: #1381804)
12+
13+ -- Iain Lane <iain@orangesquash.org.uk> Thu, 16 Oct 2014 10:16:45 +0100
14+
15 whoopsie (0.2.38) utopic; urgency=medium
16
17 [ Evan Dandrea ]
18
19=== modified file 'debian/control'
20--- debian/control 2014-07-24 12:34:15 +0000
21+++ debian/control 2014-10-16 09:41:22 +0000
22@@ -4,7 +4,7 @@
23 Maintainer: Evan Dandrea <ev@ubuntu.com>
24 Build-Depends: debhelper (>= 9.0),
25 dh-systemd,
26- libglib2.0-dev (>= 2.31.6),
27+ libglib2.0-dev (>= 2.32),
28 libcurl4-openssl-dev,
29 libgcrypt11-dev,
30 libcap-dev,
31
32=== modified file 'src/tests/test_monitor.c'
33--- src/tests/test_monitor.c 2014-05-12 13:45:48 +0000
34+++ src/tests/test_monitor.c 2014-10-16 09:41:22 +0000
35@@ -39,7 +39,14 @@
36 {
37 g_main_loop_quit (loop);
38 g_test_fail ();
39- return FALSE;
40+ return G_SOURCE_REMOVE;
41+}
42+
43+gboolean
44+_test_callback_quit (GMainLoop *main_loop)
45+{
46+ g_main_loop_quit (main_loop);
47+ return G_SOURCE_REMOVE;
48 }
49
50 void
51@@ -49,7 +56,7 @@
52 monitor = monitor_directory ("/fake", _test_callback_never_triggered_callback);
53 loop = g_main_loop_new (NULL, FALSE);
54
55- g_timeout_add_seconds (0.5, (GSourceFunc) g_main_loop_quit, loop);
56+ g_timeout_add (500, (GSourceFunc) _test_callback_quit, loop);
57 g_main_loop_run (loop);
58 if (monitor)
59 unmonitor_directory (monitor, _test_callback_never_triggered_callback);
60@@ -68,12 +75,12 @@
61 g_warning ("Couldn't create temporary crash file.");
62 g_test_fail ();
63 g_free (path);
64- return FALSE;
65+ return G_SOURCE_REMOVE;
66 }
67 close (fd);
68 g_free (path);
69
70- return FALSE;
71+ return G_SOURCE_REMOVE;
72 }
73
74 gboolean
75@@ -90,7 +97,7 @@
76 g_warning ("Couldn't create temporary upload file.");
77 g_test_fail ();
78 g_free (path);
79- return FALSE;
80+ return G_SOURCE_REMOVE;
81 }
82 close (fd);
83
84@@ -102,7 +109,7 @@
85 g_test_fail ();
86 }
87 g_free (path);
88- return FALSE;
89+ return G_SOURCE_REMOVE;
90 }
91
92 gboolean
93@@ -203,7 +210,7 @@
94
95 g_idle_add ((GSourceFunc) _create_crash_file, template);
96 loop = g_main_loop_new (NULL, FALSE);
97- g_timeout_add_seconds (2, (GSourceFunc) g_main_loop_quit, loop);
98+ g_timeout_add_seconds (2, (GSourceFunc) _test_callback_quit, loop);
99
100 monitor = monitor_directory (template, _test_callback_never_triggered_callback);
101 g_main_loop_run (loop);
102
103=== modified file 'src/whoopsie.c'
104--- src/whoopsie.c 2014-09-17 19:50:03 +0000
105+++ src/whoopsie.c 2014-10-16 09:41:22 +0000
106@@ -716,7 +716,7 @@
107 }
108 g_dir_close (dir);
109
110- return TRUE;
111+ return G_SOURCE_CONTINUE;
112 }
113
114 void daemonize (void)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: