[glib] gdbus-proxy: Fix erroneous timeout during following tests



commit 0f82ff12ea10b914bebcaa0c93d1c09acd2fb039
Author: Stef Walter <stefw gnome org>
Date:   Sat Nov 9 20:24:02 2013 +0100

    gdbus-proxy: Fix erroneous timeout during following tests
    
    Modified by Philip Withnall to amend a second instance in the same
    file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711809

 gio/tests/gdbus-proxy.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c
index 78a633b..8a2c324 100644
--- a/gio/tests/gdbus-proxy.c
+++ b/gio/tests/gdbus-proxy.c
@@ -835,6 +835,8 @@ fail_test (gpointer user_data)
 static void
 test_async (void)
 {
+  guint id;
+
   g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
                             G_DBUS_PROXY_FLAGS_NONE,
                             NULL,                      /* GDBusInterfaceInfo */
@@ -848,8 +850,10 @@ test_async (void)
   /* this is safe; testserver will exit once the bus goes away */
   g_assert (g_spawn_command_line_async (g_test_get_filename (G_TEST_BUILT, "gdbus-testserver", NULL), NULL));
 
-  g_timeout_add (10000, fail_test, NULL);
+  id = g_timeout_add (10000, fail_test, NULL);
   g_main_loop_run (loop);
+
+  g_source_remove (id);
 }
 
 static void
@@ -895,6 +899,7 @@ test_wellknown_noauto (void)
 {
   GError *error = NULL;
   GDBusProxy *proxy;
+  guint id;
 
   proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                          G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@@ -904,9 +909,10 @@ test_wellknown_noauto (void)
   g_assert (proxy != NULL);
 
   g_dbus_proxy_call (proxy, "method", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, check_error, NULL);
-  g_timeout_add (10000, fail_test, NULL);
+  id = g_timeout_add (10000, fail_test, NULL);
   g_main_loop_run (loop);
   g_object_unref (proxy);
+  g_source_remove (id);
 }
 
 int


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]