From c2ff9875185b49cae573c72dbbf419dbb2c4aaca Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 3 Sep 2014 10:36:14 -0400 Subject: [PATCH] Revert "gmain: Warn when g_source_remove() fails" This reverts commit a919be3d39150328874ff647fb2c2be7af3df996. --- glib/gmain.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/glib/gmain.c b/glib/gmain.c index 45ed402..085fb2b 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -2137,88 +2137,85 @@ g_main_context_find_source_by_user_data (GMainContext *context, if (context == NULL) context = g_main_context_default (); LOCK_CONTEXT (context); g_source_iter_init (&iter, context, FALSE); while (g_source_iter_next (&iter, &source)) { if (!SOURCE_DESTROYED (source) && source->callback_funcs) { GSourceFunc callback; gpointer callback_data = NULL; source->callback_funcs->get (source->callback_data, source, &callback, &callback_data); if (callback_data == user_data) break; } } g_source_iter_clear (&iter); UNLOCK_CONTEXT (context); return source; } /** * g_source_remove: * @tag: the ID of the source to remove. - * - * Removes the source with the given id from the default main context. - * - * The id of a #GSource is given by g_source_get_id(), or will be - * returned by the functions g_source_attach(), g_idle_add(), - * g_idle_add_full(), g_timeout_add(), g_timeout_add_full(), - * g_child_watch_add(), g_child_watch_add_full(), g_io_add_watch(), and - * g_io_add_watch_full(). + * + * Removes the source with the given id from the default main context. + * The id of + * a #GSource is given by g_source_get_id(), or will be returned by the + * functions g_source_attach(), g_idle_add(), g_idle_add_full(), + * g_timeout_add(), g_timeout_add_full(), g_child_watch_add(), + * g_child_watch_add_full(), g_io_add_watch(), and g_io_add_watch_full(). * * See also g_source_destroy(). You must use g_source_destroy() for sources * added to a non-default main context. * * It is a programmer error to attempt to remove a non-existent source. * * Returns: For historical reasons, this function always returns %TRUE **/ gboolean g_source_remove (guint tag) { GSource *source; - + g_return_val_if_fail (tag > 0, FALSE); source = g_main_context_find_source_by_id (NULL, tag); if (source) g_source_destroy (source); - else - g_critical ("Source ID %u was not found when attempting to remove it", tag); return source != NULL; } /** * g_source_remove_by_user_data: * @user_data: the user_data for the callback. * * Removes a source from the default main loop context given the user * data for the callback. If multiple sources exist with the same user * data, only one will be destroyed. * * Returns: %TRUE if a source was found and removed. **/ gboolean g_source_remove_by_user_data (gpointer user_data) { GSource *source; source = g_main_context_find_source_by_user_data (NULL, user_data); if (source) { g_source_destroy (source); return TRUE; } else return FALSE; } /** -- 2.0.1