[gupnp-igd] Delay quitting of main loop through idle



commit 01095d35333456a73b0ab34dc5d58348c1703d25
Author: Jens Georg <mail jensge org>
Date:   Sat Nov 5 12:25:44 2011 +0100

    Delay quitting of main loop through idle
    
    Prevents the leaking of GUPnP*Igd when running multiple test-cases
    which causes spurious warnings about "Connection terminated
    unexpectedly".

 tests/gtest/gupnp-simple-igd.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/tests/gtest/gupnp-simple-igd.c b/tests/gtest/gupnp-simple-igd.c
index 3502d2c..e3cc154 100644
--- a/tests/gtest/gupnp-simple-igd.c
+++ b/tests/gtest/gupnp-simple-igd.c
@@ -140,6 +140,12 @@ add_port_mapping_cb (GUPnPService *service,
     gupnp_service_action_return (action);
 }
 
+static gboolean
+loop_quit (gpointer user_data) {
+    g_main_loop_quit (loop);
+
+    return FALSE;
+}
 
 static void
 delete_port_mapping_cb (GUPnPService *service,
@@ -169,7 +175,9 @@ delete_port_mapping_cb (GUPnPService *service,
   g_free (remote_host);
   g_free (proto);
 
-  g_main_loop_quit (loop);
+  GSource* src = g_idle_source_new ();
+  g_source_set_callback (src, loop_quit, NULL, NULL);
+  g_source_attach (src, g_main_context_get_thread_default ());
 }
 
 static void



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