[glib/th/gdbus-doc-unsubscribe-idle: 4/4] main: document notify function gets called during g_source_destroy()




commit b643af6ac48389051dfa1fdaf908038c50cf94c5
Author: Thomas Haller <thaller redhat com>
Date:   Sun Apr 18 21:01:19 2021 +0200

    main: document notify function gets called during g_source_destroy()
    
    This seems non-obvious to me. Document it.
    
    It also seems important, because it means that the data pointer might
    already be destroyed, before the source is unrefed for good.

 glib/gmain.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 2e1ab3a25..c7c47ad6d 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1761,6 +1761,11 @@ g_source_set_callback_indirect (GSource              *source,
  * It is safe to call this function multiple times on a source which has already
  * been attached to a context. The changes will take effect for the next time
  * the source is dispatched after this call returns.
+ *
+ * The @notify function gets invoked during g_source_destroy() if the source
+ * was attached, or during g_source_unref() otherwise.
+ * Calling g_source_set_callback() will also invoke the @notify function of
+ * the previous callback, if any.
  **/
 void
 g_source_set_callback (GSource        *source,


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