[gnome-control-center] background: Fix crash when exiting panel too quickly
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Fix crash when exiting panel too quickly
- Date: Wed, 17 Oct 2012 07:40:58 +0000 (UTC)
commit 0d9fd1005f078076eefa0ddc846fdf7d37b96bcb
Author: Bastien Nocera <hadess hadess net>
Date: Wed Oct 17 09:38:05 2012 +0200
background: Fix crash when exiting panel too quickly
The background capture would still be on-going, and we would
crash poking at the now gone panel.
https://bugzilla.redhat.com/show_bug.cgi?id=866973
panels/background/cc-background-panel.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 02c51b0..0259aa9 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -61,6 +61,7 @@ struct _CcBackgroundPanelPrivate
CcBackgroundItem *current_background;
GCancellable *copy_cancellable;
+ GCancellable *capture_cancellable;
GtkWidget *spinner;
@@ -97,6 +98,15 @@ cc_background_panel_dispose (GObject *object)
priv->copy_cancellable = NULL;
}
+ if (priv->capture_cancellable)
+ {
+ /* cancel screenshot operations */
+ g_cancellable_cancel (priv->capture_cancellable);
+
+ g_object_unref (priv->capture_cancellable);
+ priv->capture_cancellable = NULL;
+ }
+
g_clear_object (&priv->thumb_factory);
g_clear_object (&priv->display_screenshot);
@@ -247,6 +257,10 @@ on_screenshot_finished (GObject *source,
&error);
if (error != NULL) {
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_error_free (error);
+ return;
+ }
g_debug ("Unable to get screenshot: %s",
error->message);
g_error_free (error);
@@ -376,7 +390,7 @@ get_screenshot_async (CcBackgroundPanel *panel)
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
- NULL,
+ priv->capture_cancellable,
on_screenshot_finished,
data);
}
@@ -748,6 +762,7 @@ cc_background_panel_init (CcBackgroundPanel *self)
self);
priv->copy_cancellable = g_cancellable_new ();
+ priv->capture_cancellable = g_cancellable_new ();
priv->thumb_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]