Skip to content

polkitagent: Add g_autoptr() support for GObject-derived types

Benedikt Ames requested to merge wisperwind/polkit:polkitagent_autoptr into master

This fixes the same issue that commit 004bd37d fixed for the main polkit code in polkitagent. If these definition are not made, subclassing e.g. PolkitAgentListener using G_DECLARE_FINAL_TYPE/G_DECLARE_DERIVABLE_TYPE fails with errors like

/usr/include/glib-2.0/glib/gmacros.h:1028:49: error: ‘glib_autoptr_clear_PolkitAgentListener’ undeclared (first use in this function); did you mean ‘glib_autoptr_clear_GSocketListener’?
 1028 | #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName
      |                                                 ^~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1051:64: note: in definition of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
 1051 |     { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) cleanup); }                                      \
      |                                                                ^~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:1056:65: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’
 1056 |   _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName))
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:1408:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CHAINUP’
 1408 |   _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/listener.h:11:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’
   11 | G_DECLARE_FINAL_TYPE (MyListener, my_listener, MY, LISTENER,
      | ^~~~~~~~~~~~~~~~~~~~

Merge request reports