diff --git a/src/libsysprof/sysprof-backport-autocleanups.h b/src/libsysprof/sysprof-backport-autocleanups.h index 2ff37928..51eaba82 100644 --- a/src/libsysprof/sysprof-backport-autocleanups.h +++ b/src/libsysprof/sysprof-backport-autocleanups.h @@ -2,6 +2,8 @@ #include "config.h" +#include + #ifndef HAVE_POLKIT_AUTOPTR # include @@ -10,3 +12,14 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitSubject, g_object_unref) #endif +#if !GLIB_CHECK_VERSION(2, 56, 0) + static inline void + g_clear_handle_id (guint *ptr, + void (*clear_func) (guint handle_id)) + { + guint id = *ptr; + *ptr = 0; + if (id) + clear_func (handle_id); + } +#endif