diff --git a/steam-runtime-tools/desktop-entry.h b/steam-runtime-tools/desktop-entry.h
index 795f7b7d7ee4bc6330862f790d4500a836bf1de1..fece53de0c5e77b518b1582940eeb72b65cc7b34 100644
--- a/steam-runtime-tools/desktop-entry.h
+++ b/steam-runtime-tools/desktop-entry.h
@@ -48,3 +48,7 @@ const char *srt_desktop_entry_get_commandline (SrtDesktopEntry *self);
 const char *srt_desktop_entry_get_filename (SrtDesktopEntry *self);
 gboolean srt_desktop_entry_is_default_handler (SrtDesktopEntry *self);
 gboolean srt_desktop_entry_is_steam_handler (SrtDesktopEntry *self);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtDesktopEntry, g_object_unref)
+#endif
diff --git a/steam-runtime-tools/steam.h b/steam-runtime-tools/steam.h
index ad8537e3dbb065133dc16eb940d9bc5761bb8cc8..7a1ed871ae3c3ec6a52a6ea9e77673f7841ee8bb 100644
--- a/steam-runtime-tools/steam.h
+++ b/steam-runtime-tools/steam.h
@@ -113,3 +113,7 @@ SrtSteamIssues srt_steam_get_issues (SrtSteam *self);
 const char *srt_steam_get_install_path (SrtSteam *self);
 const char *srt_steam_get_data_path (SrtSteam *self);
 const char *srt_steam_get_bin32_path (SrtSteam *self);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SrtSteam, g_object_unref)
+#endif