|
0 |
From: =?utf-8?q?Guido_G=C3=BCnther?= <agx@sigxcpu.org>
|
|
1 |
Date: Fri, 17 Oct 2014 17:23:52 +0200
|
|
2 |
Subject: Don't run main loop twice
|
|
3 |
|
|
4 |
Running the main loop twice segfaults on non i386 architectures even
|
|
5 |
with all libvirt and libvirt-glib code removed. So work around this by
|
|
6 |
manually iterating the loop to avoid the first quit.
|
|
7 |
|
|
8 |
Closes: #765566
|
|
9 |
---
|
|
10 |
tests/test-events.c | 6 ++++--
|
|
11 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
12 |
|
|
13 |
diff --git a/tests/test-events.c b/tests/test-events.c
|
|
14 |
index ee7ff0b..6f65e76 100644
|
|
15 |
--- a/tests/test-events.c
|
|
16 |
+++ b/tests/test-events.c
|
|
17 |
@@ -91,11 +91,13 @@ static gboolean test_watch(gpointer user_data)
|
|
18 |
|
|
19 |
static void test_remove_disabled_watch(void)
|
|
20 |
{
|
|
21 |
+ GMainContext *context;
|
|
22 |
main_loop = g_main_loop_new(NULL, FALSE);
|
|
23 |
+ context = g_main_loop_get_context(main_loop);
|
|
24 |
watch_fd = open("/bin/true", O_RDONLY);
|
|
25 |
g_idle_add(test_watch, NULL);
|
|
26 |
- g_main_loop_run(main_loop);
|
|
27 |
- g_main_loop_unref(main_loop);
|
|
28 |
+ g_main_context_iteration(context, TRUE);
|
|
29 |
+ g_main_context_iteration(context, TRUE);
|
|
30 |
close(watch_fd);
|
|
31 |
watch_fd = -1;
|
|
32 |
g_assert_cmpint(watch_id, ==, -1);
|