From 0389a4786c73a9ca112fe58a293777da2c0fbb94 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 24 Jun 2021 10:51:28 +0200 Subject: [PATCH] glib-aux: prevent usage of g_source_remove*() API Searching over all sources in order to remove them is not what we want to do. If you think you need these functions, instead keep track of the GSource instances yourself. --- src/libnm-glib-aux/nm-glib.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libnm-glib-aux/nm-glib.h b/src/libnm-glib-aux/nm-glib.h index cd75acd57a..0af9e21f29 100644 --- a/src/libnm-glib-aux/nm-glib.h +++ b/src/libnm-glib-aux/nm-glib.h @@ -684,11 +684,21 @@ g_hash_table_steal_extended(GHashTable * hash_table, /*****************************************************************************/ -_nm_deprecated("Don't use g_cancellable_reset(). Create a new cancellable " - "instead.") void _nm_g_cancellable_reset(GCancellable *cancellable); +_nm_deprecated("Don't use this API") void _nm_forbidden_glib_api_0(void); +_nm_deprecated("Don't use this API") void _nm_forbidden_glib_api_n(gconstpointer arg0, ...); #undef g_cancellable_reset -#define g_cancellable_reset(cancellable) _nm_g_cancellable_reset(cancellable) +#define g_cancellable_reset(cancellable) _nm_forbidden_glib_api_n(cancellable) + +#undef g_idle_remove_by_data +#define g_idle_remove_by_data(data) _nm_forbidden_glib_api_n(data) + +#undef g_source_remove_by_funcs_user_data +#define g_source_remove_by_funcs_user_data(funcs, user_data) \ + _nm_forbidden_glib_api_n(funcs, user_data) + +#undef g_source_remove_by_user_data +#define g_source_remove_by_user_data(user_data) _nm_forbidden_glib_api_n(user_data) /*****************************************************************************/