Web lists-archives.com

[PATCH 2/2] 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.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 glib/gmain.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/glib/gmain.c b/glib/gmain.c
index 1e9850f..410c1f1 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -3629,8 +3629,12 @@ g_main_context_check (GMainContext *context,
       return FALSE;
     }
 
-  if (context->wake_up_rec.revents)
-    g_wakeup_acknowledge (context->wakeup);
+  for (i = 0; i < n_fds; ++i)
+    if (fds[i].fd == context->wake_up_rec.fd) {
+      if (fds[i].revents)
+        g_wakeup_acknowledge (context->wakeup);
+      break;
+    }
 
   /* If the set of poll file descriptors changed, bail out
    * and let the main loop rerun
-- 
2.4.3

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list