From 515dac258cf93315b5bd4ab29eb086e144378dd0 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 21 Jun 2018 17:09:57 +0100 Subject: [PATCH] gmain: Clarify documentation for g_source_get_id() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s good to know *which* GMainContext is used to determine the ID, and the preconditions for calling this method. Using wording suggested by Emmanuele Bassi . Signed-off-by: Philip Withnall --- glib/gmain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glib/gmain.c b/glib/gmain.c index 7d49025c7..5f0b05198 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1296,6 +1296,11 @@ g_source_destroy (GSource *source) * context. The reverse * mapping from ID to source is done by g_main_context_find_source_by_id(). * + * You can only call this function while the source is associated to a + * #GMainContext instance; calling this function before g_source_attach() + * or after g_source_destroy() yields undefined behavior. The ID returned + * is unique within the #GMainContext instance passed to g_source_attach(). + * * Returns: the ID (greater than 0) for the source **/ guint