mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-27 18:10:03 +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;
|
GMainContext *context;
|
||||||
gboolean consumed[10] = { };
|
gboolean consumed[10] = { };
|
||||||
GPollFD poll_fds[10];
|
GPollFD poll_fds[10];
|
||||||
|
gboolean acquired;
|
||||||
gboolean immediate;
|
gboolean immediate;
|
||||||
gint max_priority;
|
gint max_priority;
|
||||||
gint timeout;
|
gint timeout;
|
||||||
@ -1222,6 +1223,9 @@ assert_main_context_state (gint n_to_poll,
|
|||||||
|
|
||||||
context = g_main_context_default ();
|
context = g_main_context_default ();
|
||||||
|
|
||||||
|
acquired = g_main_context_acquire (context);
|
||||||
|
g_assert (acquired);
|
||||||
|
|
||||||
immediate = g_main_context_prepare (context, &max_priority);
|
immediate = g_main_context_prepare (context, &max_priority);
|
||||||
g_assert (!immediate);
|
g_assert (!immediate);
|
||||||
n = g_main_context_query (context, max_priority, &timeout, poll_fds, 10);
|
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))
|
if (g_main_context_check (context, max_priority, poll_fds, n))
|
||||||
g_main_context_dispatch (context);
|
g_main_context_dispatch (context);
|
||||||
|
|
||||||
|
g_main_context_release (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user