summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Azzarone <azzaronea@gmail.com>2018-05-07 21:11:27 +0200
committerAndrea Azzarone <azzaronea@gmail.com>2018-05-10 00:56:19 +0200
commit1d26f63b18f54e2d354d64ec8b312c70b35a2808 (patch)
tree52db5b977a0601d891f4d4f97511971d996249c8
parent6ec0bcde1520e0cee19f6596b4b03c801a1ca571 (diff)
downloadgnome-control-center-1d26f63b18f54e2d354d64ec8b312c70b35a2808.tar.gz
night-ligth-dialog: Avoid dereferencing invalid pointer
dialog_got_proxy_cb and dialog_got_proxy_props_cb may be called after the instance of CcNightLightDialog has been disposed. Make sure 'self' pointer is not dereferenced if not valid. Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/86
-rw-r--r--panels/display/cc-night-light-dialog.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/panels/display/cc-night-light-dialog.c b/panels/display/cc-night-light-dialog.c
index 1d03ba393..b26b9e3e5 100644
--- a/panels/display/cc-night-light-dialog.c
+++ b/panels/display/cc-night-light-dialog.c
@@ -386,13 +386,18 @@ static void
dialog_got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
+ GDBusProxy *proxy;
g_autoptr(GError) error = NULL;
- self->proxy_color = cc_object_storage_create_dbus_proxy_finish (res, &error);
- if (self->proxy_color == NULL)
+
+ proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
+ if (proxy == NULL)
{
g_warning ("failed to connect to g-s-d: %s", error->message);
return;
}
+
+ self->proxy_color = proxy;
+
g_signal_connect_object (self->proxy_color, "g-properties-changed",
G_CALLBACK (dialog_color_properties_changed_cb), self, 0);
dialog_update_state (self);
@@ -403,13 +408,17 @@ static void
dialog_got_proxy_props_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
+ GDBusProxy *proxy;
g_autoptr(GError) error = NULL;
- self->proxy_color_props = cc_object_storage_create_dbus_proxy_finish (res, &error);
- if (self->proxy_color_props == NULL)
+
+ proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
+ if (proxy == NULL)
{
g_warning ("failed to connect to g-s-d: %s", error->message);
return;
}
+
+ self->proxy_color_props = proxy;
}
static gboolean