Commit ae22f72c authored by Benjamin Berg's avatar Benjamin Berg

display: Prevent error when serializing invalid configuration

If no monitors are enabled, then the variant would end up with an
invalid variant type, causing a crash later on. This case only happened
due to other bugs (i.e. in principle we should never send a
configuration without any monitors to the server).

Prevent the serialization error by specifying the correct type for the
builder, therefore potentially preventing a crash in such a corner case.
parent 0c4e84e4
......@@ -951,7 +951,7 @@ build_logical_monitors_parameter (CcDisplayConfigDBus *self)
GHashTableIter iter;
CcDisplayLogicalMonitor *logical_monitor;
g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(iiduba(ssa{sv}))"));
g_hash_table_iter_init (&iter, self->logical_monitors);
while (g_hash_table_iter_next (&iter, (void **) &logical_monitor, NULL))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment