[libsoup] tests/connection-test: Ensure quit source id is reset to 0 between runs



commit 45d84ff3a03f547819fa53731df5d7b2b72150d0
Author: Colin Walters <walters verbum org>
Date:   Sun Nov 3 17:06:22 2013 -0500

    tests/connection-test: Ensure quit source id is reset to 0 between runs
    
    Otherwise we may attempt to remove a nonexistent quit loop from the
    previous one.  The second hunk here is the real fix, the first is just
    being more defensive/consistent.
    
    Reported-By: Kjartan Maraas <kmaraas gnome org>
    Tested-By: Kjartan Maraas <kmaraas gnome org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711361

 tests/connection-test.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/tests/connection-test.c b/tests/connection-test.c
index 3d51753..fd7179f 100644
--- a/tests/connection-test.c
+++ b/tests/connection-test.c
@@ -495,6 +495,8 @@ do_max_conns_test_for_session (SoupSession *session)
 
        msgs_done = 0;
        g_idle_add (idle_start_server, NULL);
+       if (quit_loop_timeout)
+               g_source_remove (quit_loop_timeout);
        quit_loop_timeout = g_timeout_add (1000, quit_loop, NULL);
        g_main_loop_run (max_conns_loop);
 
@@ -517,8 +519,10 @@ do_max_conns_test_for_session (SoupSession *session)
        }
 
        g_main_loop_unref (max_conns_loop);
-       if (quit_loop_timeout)
+       if (quit_loop_timeout) {
                g_source_remove (quit_loop_timeout);
+               quit_loop_timeout = 0;
+       }
 
        for (i = 0; i < TEST_CONNS; i++)
                g_object_unref (msgs[i]);


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