[gnome-settings-daemon/gnome-3-18] color: Fix a crash when cancelling setting up screens
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-18] color: Fix a crash when cancelling setting up screens
- Date: Tue, 15 Mar 2016 23:41:44 +0000 (UTC)
commit 5c545d3210679445a1a1a9ccef05796631e0783e
Author: Richard Hughes <richard hughsie com>
Date: Tue Mar 15 15:38:22 2016 +0000
color: Fix a crash when cancelling setting up screens
https://bugzilla.gnome.org/show_bug.cgi?id=763382
plugins/color/gsd-color-state.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/plugins/color/gsd-color-state.c b/plugins/color/gsd-color-state.c
index 948ee07..061e414 100644
--- a/plugins/color/gsd-color-state.c
+++ b/plugins/color/gsd-color-state.c
@@ -1358,10 +1358,18 @@ on_rr_screen_acquired (GObject *object,
GsdColorState *state = data;
GsdColorStatePrivate *priv = state->priv;
GnomeRRScreen *screen;
+ GError *error = NULL;
- screen = gnome_rr_screen_new_finish (result, NULL);
- if (!screen)
- return;
+ /* gnome_rr_screen_new_async() does not take a GCancellable */
+ if (g_cancellable_is_cancelled (priv->cancellable))
+ goto out;
+
+ screen = gnome_rr_screen_new_finish (result, &error);
+ if (screen == NULL) {
+ g_warning ("failed to get screens: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
priv->state_screen = screen;
@@ -1369,6 +1377,9 @@ on_rr_screen_acquired (GObject *object,
priv->cancellable,
gcm_session_client_connect_cb,
state);
+out:
+ /* manually added */
+ g_object_unref (state);
}
void
@@ -1384,7 +1395,7 @@ gsd_color_state_start (GsdColorState *state)
/* coldplug the list of screens */
gnome_rr_screen_new_async (gdk_screen_get_default (),
on_rr_screen_acquired,
- state);
+ g_object_ref (state));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]