[gnome-control-center/issue12: 4/4] display: Early return in monitor_labeler_show() if no outputs are available



commit ca9228bb59aa29d80cb2ff8f62b8690b78abb136
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Mon Mar 12 14:04:05 2018 +0000

    display: Early return in monitor_labeler_show() if no outputs are available
    
    The GVariant constructed here would be useless otherwise, since there are
    no outputs to show the labels for. Besides, calling g_variant_builder_close
    in this scenario would hit an assertion and the program would crash.
    
    https://gitlab.gnome.org/GNOME/gnome-control-center/issues/12

 panels/display/cc-display-panel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 256fc8682..0b4fa193d 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -207,13 +207,16 @@ monitor_labeler_show (CcDisplayPanel *self)
   if (!priv->shell_proxy || !priv->current_config)
     return;
 
+  outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
+  if (!outputs)
+    return;
+
   if (cc_display_config_is_cloning (priv->current_config))
     return monitor_labeler_hide (self);
 
   g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
   g_variant_builder_open (&builder, G_VARIANT_TYPE_ARRAY);
 
-  outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
   for (l = outputs; l != NULL; l = l->next)
     {
       CcDisplayMonitor *output = l->data;


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