summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2015-09-08 10:02:00 -0700
committerCosimo Cecchi <cosimoc@gnome.org>2015-09-08 10:10:00 -0700
commitdb449dc49ea1145f0139562fc7d0797bfaaa16e9 (patch)
tree91e23bd76dcab788425b724429aca20a0f647f3d
parent3af59f7c03cb81c7f9801890415bcef1dea76820 (diff)
downloadgnome-control-center-db449dc49ea1145f0139562fc7d0797bfaaa16e9.tar.gz
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
-rw-r--r--panels/power/cc-power-panel.c11
1 files 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)