Re: main context iteration



All rigth, I now understand what prepare is really for... :-)
The implementation is also all right, I didn't think enough.

However the bug is bug, so here is the patch:

--- gmain.c	Thu Nov  1 01:01:50 2001
+++ gmain.c	Fri Nov 30 19:24:16 2001
@@ -2161,7 +2161,7 @@
 {
   gint max_priority;
   gint timeout;
-  gboolean some_ready;
+  gboolean dispatch_ready;
   gint nfds, allocated_nfds;
   GPollFD *fds = NULL;
   @@ -2207,7 +2207,7 @@
      UNLOCK_CONTEXT (context);
- some_ready = g_main_context_prepare (context, &max_priority); + g_main_context_prepare (context, &max_priority); while ((nfds = g_main_context_query (context, max_priority, &timeout, fds, allocated_nfds)) > allocated_nfds)
@@ -2224,9 +2224,9 @@
      g_main_context_poll (context, timeout, max_priority, fds, nfds);
   -  g_main_context_check (context, max_priority, fds, nfds);
+ dispatch_ready = g_main_context_check (context, max_priority, fds, nfds);
   -  if (dispatch)
+  if (dispatch && dispatch_ready)
     g_main_context_dispatch (context);
    #ifdef G_THREADS_ENABLED
@@ -2235,7 +2235,7 @@
    LOCK_CONTEXT (context);
 -  return some_ready;
+  return dispatch_ready;
 }
  /**

Chaoron

--
"Software is like sex, it's better when it's free." - Linus

http://people.inf.elte.hu/chaoron

-----BEGIN GEEK CODE BLOCK-----
GCS/M/S d- s:(-:-) a-- C++(+++)$ ULS++(+++)$ P- L+++ E- W++ N+ o? K? w--
O- M- V PS++ PE++ Y+ PGP>+ t-- 5-- X- R+ tv- b++ DI? D+
G++ e+ h--- r+++ y+++
------END GEEK CODE BLOCK------



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