[gnome-control-center/benzea/ensure-valid-config-after-loading: 85/91] display: Prevent error when serializing invalid configuration



commit 92e463bfc06201ab567b4584867c167f102cb468
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Mar 20 14:31:57 2019 +0100

    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.

 panels/display/cc-display-config-dbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 6db267d8b..752184be5 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]