[glib: 4/5] gtestdbus: Clarify comment on dropping connection ref



commit d4db5a828883a040be00dd0f80400132220a1b72
Author: Matthew Leeds <matthew leeds endlessm com>
Date:   Tue Jul 2 15:54:52 2019 -0700

    gtestdbus: Clarify comment on dropping connection ref
    
    In _g_object_unref_and_wait_weak_notify() we take a weak reference and
    then call g_object_unref() in an idle callback, which may look like
    we're dropping a strong reference without having one. So change the
    comment to make it more clear that the reference being dropped is held
    by the caller.

 gio/gtestdbus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c
index 6c060aa7c..11cf029d9 100644
--- a/gio/gtestdbus.c
+++ b/gio/gtestdbus.c
@@ -84,8 +84,9 @@ _g_object_unref_and_wait_weak_notify (gpointer object)
 
   g_object_weak_ref (object, (GWeakNotify) g_main_loop_quit, data.loop);
 
-  /* Drop the ref in an idle callback, this is to make sure the mainloop
-   * is already running when weak notify happens */
+  /* Drop the strong ref held by the caller in an idle callback. This is to
+   * make sure the mainloop is already running when weak notify happens (when
+   * all other strong ref holders have dropped theirs). */
   g_idle_add (unref_on_idle, object);
 
   /* Make sure we don't block forever */


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