GNOME Bugzilla – Bug 733537
g_main_context_wait() not deprecated in API, but emits a g_critical() if used
Last modified: 2018-05-24 16:47:55 UTC
I happened to notice this commit: g_main_context_wait: add a critical to detect use Due to its unusual interface, I suspect that nobody is using g_main_context_wait() but there is no way to know. Add a critical notice that will be displayed if anyone calls the function, asking them to file a bug with us. Debian is large, so codesearch.debian.net is often a good answer to this sort of thing, so I tried it. Apart from language bindings and embedded copies of GLib, the only user I found was EFL (Enlightenment), e.g. in this code: http://git.enlightenment.org/core/efl.git/commit/?id=2ca0be9316d63da11d88a1b2c85606e020790911 If the EFL developers are using it inappropriately, please enlighten them. (I do not use EFL myself and have no particular interest in this functionality, other than "deleting functionality from what is meant to be a stable library ABI seems bad".)
^ That was commit c0aa150cb0d362224480240b2db8ff214717bdd1 EFL have switched to use the, seemingly OK, g_main_context_is_owner() instead https://git.enlightenment.org/core/efl.git/commit/src/lib/ecore/ecore_glib.c?id=7a046b0c368d45076f505ca8206b68f6a8554453 Regardless, my question would be - if g_main_context_wait() is indeed pencilled for removal - why it is not marked as deprecated in the API using the normal means, but instead just buries a critical in the implementation.
(In reply to Daniel Boles from comment #1) > Regardless, my question would be - if g_main_context_wait() is indeed > pencilled for removal - why it is not marked as deprecated in the API using > the normal means, but instead just buries a critical in the implementation. No idea. It would obviously be better to mark it as deprecated in a more standard way (in the documentation, and using GLIB_DEPRECATED_IN_*_FOR()). Patch welcome. :-)
Another question: I have just written some code using g_main_context_wait() for which there does not appear to be any alternative non-Glib-CRITICAL-spewing API. If it is to be removed, what is the alternative?
(In reply to Christopher Halse Rogers from comment #3) > Another question: I have just written some code using g_main_context_wait() > for which there does not appear to be any alternative > non-Glib-CRITICAL-spewing API. > > If it is to be removed, what is the alternative? You are unlikely to get a clear answer to that question without more details of your code that uses g_main_context_wait(), and what it aims to achieve by it. Having a main context per thread, and passing messages between them with g_main_context_invoke[_full]() or similar, is a more conventional mechanism than having a single main context shared between threads and passing ownership of that main-context between threads. Does that help you?
Created attachment 372118 [details] [review] gmain: Officially deprecate g_main_context_wait() It’s been de-facto deprecated for a long time, due to emitting a critical warning when used in a non-internal context. Make that official in the documentation and with a deprecation annotation. Split the implementation into an internal helper and an external wrapper, so the two remaining internal uses don’t emit deprecation warnings. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/903.