[glib] glib/tests/mainloop: Acquire the context while asserting its state



commit 9f5afe3966d31ef6f1e880d950206a0325e6c777
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date:   Sun Sep 22 23:34:27 2013 +0300

    glib/tests/mainloop: Acquire the context while asserting its state
    
    The iteration methods presume that the context is acquired.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699132

 glib/tests/mainloop.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index df1dfb6..8abd262 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -1213,6 +1213,7 @@ assert_main_context_state (gint n_to_poll,
   GMainContext *context;
   gboolean consumed[10] = { };
   GPollFD poll_fds[10];
+  gboolean acquired;
   gboolean immediate;
   gint max_priority;
   gint timeout;
@@ -1222,6 +1223,9 @@ assert_main_context_state (gint n_to_poll,
 
   context = g_main_context_default ();
 
+  acquired = g_main_context_acquire (context);
+  g_assert (acquired);
+
   immediate = g_main_context_prepare (context, &max_priority);
   g_assert (!immediate);
   n = g_main_context_query (context, max_priority, &timeout, poll_fds, 10);
@@ -1254,6 +1258,8 @@ assert_main_context_state (gint n_to_poll,
 
   if (g_main_context_check (context, max_priority, poll_fds, n))
     g_main_context_dispatch (context);
+
+  g_main_context_release (context);
 }
 
 static gboolean


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