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
This commit is contained in:
parent
6ec0bcde15
commit
1d26f63b18
1 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue