From db449dc49ea1145f0139562fc7d0797bfaaa16e9 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 8 Sep 2015 10:02:00 -0700 Subject: power: don't assume we have a Screen proxy when IIO proxy is ready On panel construction, we trigger asynchronous creation of a GDBusProxy for the IIO sensors daemon and one for the Screen g-s-d interface. Since there's no guarantee we'll have the screen proxy ready by the time the IIO proxy is constructed, guard for (priv->screen_proxy != NULL), or we'll hit a critical. https://bugzilla.gnome.org/show_bug.cgi?id=754735 --- panels/power/cc-power-panel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c index b694989ed..4a96fe9ed 100644 --- a/panels/power/cc-power-panel.c +++ b/panels/power/cc-power-panel.c @@ -981,11 +981,14 @@ als_enabled_state_changed (CcPowerPanel *self) gboolean visible = FALSE; GVariant *v; - v = g_dbus_proxy_get_cached_property (self->priv->screen_proxy, "Brightness"); - if (v != NULL) + if (priv->screen_proxy != NULL) { - has_brightness = g_variant_get_int32 (v) >= 0.0; - g_variant_unref (v); + v = g_dbus_proxy_get_cached_property (priv->screen_proxy, "Brightness"); + if (v != NULL) + { + has_brightness = g_variant_get_int32 (v) >= 0.0; + g_variant_unref (v); + } } if (priv->iio_proxy != NULL) -- cgit v1.2.1