Fix GVariant leak when display config is changed, ie. device is rotated
This commit is contained in:
parent
fd64a9312c
commit
c1701921e5
10
src/main.c
10
src/main.c
|
@ -923,20 +923,20 @@ static void
|
||||||
display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_data)
|
display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error = NULL;
|
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) {
|
if (!result) {
|
||||||
printf("Failed to get display configuration: %s\n", error->message);
|
printf("Failed to get display configuration: %s\n", error->message);
|
||||||
return;
|
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) {
|
if (g_variant_n_children(configs) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GVariant *config = g_variant_get_child_value(configs, 0);
|
g_autoptr(GVariant) config = g_variant_get_child_value(configs, 0);
|
||||||
GVariant *rot_config = g_variant_get_child_value(config, 7);
|
g_autoptr(GVariant) rot_config = g_variant_get_child_value(config, 7);
|
||||||
uint32_t rotation_index = g_variant_get_uint32(rot_config);
|
uint32_t rotation_index = g_variant_get_uint32(rot_config);
|
||||||
|
|
||||||
assert(rotation_index < 4);
|
assert(rotation_index < 4);
|
||||||
|
@ -947,8 +947,6 @@ display_config_received(GDBusConnection *conn, GAsyncResult *res, gpointer user_
|
||||||
update_io_pipeline();
|
update_io_pipeline();
|
||||||
update_ui_rotation();
|
update_ui_rotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_variant_unref(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue