GNOME Bugzilla – Bug 317775
main loops continues to run after g_main_loop_quit() has been called
Last modified: 2011-02-18 16:14:20 UTC
The program I will attach installs two idle handlers, where the first one calls g_main_loop_quit() and the second one prints a message. The result of running the program is that the second idle handler runs and prints the message, which is wrong in my opinion. I would expect g_main_loop_quit() to cause the main loop to stop running immediately, not at some unspecified point in the future. If this is not considered a bug, please at least mention this weird trap in the documentation.
Created attachment 52951 [details] The program
It's just a natural consequence of the facts that: - g_main_context_iteration() dispatches all sources at the same priority in one go. - GMainLoop is a higher level object built on the low level, the low level (mostly) doesn't know about it. Feel free to suggest a doc improvement.
2007-11-08 Matthias Clasen <mclasen@redhat.com> * glib/gmain.c (g_main_loop_quit): Expand the docs a bit. (#317775, Søren Sandmann)