Do not use revents as not updated

revents is set in the same function after some lines. This check was
using revents from previous loop. This had the problem of causing two
poll execution for every changes to poll records.

Note that is not possible to move the code after revents is updated
as probably poll_changed is TRUE causing the function to exit.

Adapted from a patch by Frediano Ziglio,

https://bugzilla.gnome.org/show_bug.cgi?id=761102
This commit is contained in:
Matthias Clasen 2016-07-16 21:07:27 -04:00
parent e4ee3079c5
commit 48ea710ee3

View File

@ -3695,10 +3695,17 @@ g_main_context_check (GMainContext *context,
TRACE (GLIB_MAIN_CONTEXT_BEFORE_CHECK (context, max_priority, fds, n_fds));
if (context->wake_up_rec.revents)
for (i = 0; i < n_fds; i++)
{
TRACE (GLIB_MAIN_CONTEXT_WAKEUP_ACKNOWLEDGE (context));
g_wakeup_acknowledge (context->wakeup);
if (fds[i].fd == context->wake_up_rec.fd)
{
if (fds[i].revents)
{
TRACE (GLIB_MAIN_CONTEXT_WAKEUP_ACKNOWLEDGE (context));
g_wakeup_acknowledge (context->wakeup);
}
break;
}
}
/* If the set of poll file descriptors changed, bail out