gtkprivate: Remove g_auto usage

Fixes: 93ab478af1
This commit is contained in:
Bastien Nocera 2020-03-30 17:50:50 +02:00
parent fa16b682ef
commit 8dfb1d197a

View File

@ -304,10 +304,10 @@ guint
gtk_get_portal_interface_version (GDBusConnection *connection, gtk_get_portal_interface_version (GDBusConnection *connection,
const char *interface_name) const char *interface_name)
{ {
g_autoptr(GDBusProxy) proxy = NULL; GDBusProxy *proxy = NULL;
g_autoptr(GError) error = NULL; GError *error = NULL;
g_autoptr(GVariant) ret = NULL; GVariant *ret = NULL;
g_autofree char *owner = NULL; char *owner = NULL;
guint version = 0; guint version = 0;
proxy = g_dbus_proxy_new_sync (connection, proxy = g_dbus_proxy_new_sync (connection,
@ -323,14 +323,14 @@ gtk_get_portal_interface_version (GDBusConnection *connection,
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Could not query portal version on interface '%s': %s", g_warning ("Could not query portal version on interface '%s': %s",
interface_name, error->message); interface_name, error->message);
return 0; goto out;
} }
owner = g_dbus_proxy_get_name_owner (proxy); owner = g_dbus_proxy_get_name_owner (proxy);
if (owner == NULL) if (owner == NULL)
{ {
g_debug ("%s not provided by any service", interface_name); g_debug ("%s not provided by any service", interface_name);
return FALSE; goto out;
} }
ret = g_dbus_proxy_get_cached_property (proxy, "version"); ret = g_dbus_proxy_get_cached_property (proxy, "version");
@ -340,6 +340,12 @@ gtk_get_portal_interface_version (GDBusConnection *connection,
g_debug ("Got version %u for portal interface '%s'", g_debug ("Got version %u for portal interface '%s'",
version, interface_name); version, interface_name);
out:
g_clear_object (&proxy);
g_clear_error (&error);
g_clear_pointer (&ret, g_variant_unref);
g_clear_pointer (&owner, g_free);
return version; return version;
} }