Fix GVariant leak when display config is changed, ie. device is rotated

This commit is contained in:
Benjamin Schaaf 2021-12-13 22:35:05 +11:00 committed by Martijn Braam
parent 86f50c20f2
commit e9c1eeaa40
No known key found for this signature in database
GPG Key ID: C4280ACB000B060F
1 changed files with 4 additions and 6 deletions

View File

@ -923,20 +923,20 @@ static void
display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_data)
{
g_autoptr(GError) error = NULL;
GVariant *result = g_dbus_connection_call_finish(conn, res, &error);
g_autoptr(GVariant) result = g_dbus_connection_call_finish(conn, res, &error);
if (!result) {
printf("Failed to get display configuration: %s\n", error->message);
return;
}
GVariant *configs = g_variant_get_child_value(result, 1);
g_autoptr(GVariant) configs = g_variant_get_child_value(result, 1);
if (g_variant_n_children(configs) == 0) {
return;
}
GVariant *config = g_variant_get_child_value(configs, 0);
GVariant *rot_config = g_variant_get_child_value(config, 7);
g_autoptr(GVariant) config = g_variant_get_child_value(configs, 0);
g_autoptr(GVariant) rot_config = g_variant_get_child_value(config, 7);
uint32_t rotation_index = g_variant_get_uint32(rot_config);
assert(rotation_index < 4);
@ -947,8 +947,6 @@ display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_
update_io_pipeline();
update_ui_rotation();
}
g_variant_unref(result);
}
static void