[glib] g_main_context_wait: add a critical to detect use



commit c0aa150cb0d362224480240b2db8ff214717bdd1
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Feb 21 16:25:09 2014 -0500

    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.
    
    We'll let this go out with the 2.40 release and see if we get a response
    before we proceed with actually breaking the functionality.

 glib/gmain.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index dbbc63d..bce602d 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -3229,6 +3229,18 @@ g_main_context_wait (GMainContext *context,
   if (context == NULL)
     context = g_main_context_default ();
 
+  if G_UNLIKELY (cond != &context->cond || mutex != &context->mutex)
+    {
+      static gboolean warned;
+
+      if (!warned)
+        {
+          g_critical ("WARNING!! g_main_context_wait() will be removed in a future release.  "
+                      "If you see this message, please file a bug immediately.");
+          warned = TRUE;
+        }
+    }
+
   loop_internal_waiter = (mutex == &context->mutex);
   
   if (!loop_internal_waiter)


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