glib-aux: add nm_auto_pop_and_unref_gmaincontext cleanup macro

This commit is contained in:
Thomas Haller 2021-05-10 20:43:51 +02:00
parent 071ef784cf
commit 8a11380e80
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1564,6 +1564,18 @@ NM_AUTO_DEFINE_FCN0(GSource *, _nm_auto_destroy_and_unref_gsource, nm_g_source_d
NM_AUTO_DEFINE_FCN0(GMainContext *, _nm_auto_pop_gmaincontext, g_main_context_pop_thread_default);
#define nm_auto_pop_gmaincontext nm_auto(_nm_auto_pop_gmaincontext)
static inline void
nm_g_main_context_pop_and_unref(GMainContext *context)
{
g_main_context_pop_thread_default(context);
g_main_context_unref(context);
}
NM_AUTO_DEFINE_FCN0(GMainContext *,
_nm_auto_pop_and_unref_gmaincontext,
nm_g_main_context_pop_and_unref);
#define nm_auto_pop_and_unref_gmaincontext nm_auto(_nm_auto_pop_and_unref_gmaincontext)
static inline gboolean
nm_source_func_unref_gobject(gpointer user_data)
{