Add g_autoptr(BuilderObjectList) support

This is a deeply freed GList of GObjects.

Closes: #77
Approved by: alexlarsson
tingping/wmclass
Alexander Larsson 2017-12-07 15:51:28 +01:00 committed by Atomic Bot
parent 5a6a3a830b
commit c572831b21
1 changed files with 10 additions and 0 deletions

View File

@ -276,6 +276,16 @@ flatpak_temp_dir_destroy (void *p)
typedef GFile FlatpakTempDir;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakTempDir, flatpak_temp_dir_destroy)
static inline void
builder_object_list_destroy (void *p)
{
GList *list = p;
g_list_free_full (list, g_object_unref);
}
typedef GList BuilderObjectList;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderObjectList, builder_object_list_destroy)
#define AUTOLOCK(name) G_GNUC_UNUSED __attribute__((cleanup (flatpak_auto_unlock_helper))) GMutex * G_PASTE (auto_unlock, __LINE__) = flatpak_auto_lock_helper (&G_LOCK_NAME (name))