mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-14 19:55:12 +01:00
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
This commit is contained in:
parent
c0e8f8a8db
commit
9f5afe3966
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user