[gnome-control-center] background: Consolidate exit path
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Consolidate exit path
- Date: Thu, 14 Nov 2013 14:37:15 +0000 (UTC)
commit 3ec49452a1fd7450c86ebe765c5526c8939dc163
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Nov 14 11:54:35 2013 +0100
background: Consolidate exit path
https://bugzilla.gnome.org/show_bug.cgi?id=708942
panels/background/bg-pictures-source.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index 0fb6e16..b82e5b3 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -138,9 +138,9 @@ picture_scaled (GObject *source_object,
gpointer user_data)
{
BgPicturesSource *bg_source;
- CcBackgroundItem *item;
+ CcBackgroundItem *item = NULL;
GError *error = NULL;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
const char *software;
const char *uri;
GtkTreeIter iter;
@@ -153,7 +153,7 @@ picture_scaled (GObject *source_object,
g_warning ("Failed to load image: %s", error->message);
g_error_free (error);
- return;
+ goto out;
}
/* since we were not cancelled, we can now cast user_data
@@ -171,9 +171,7 @@ picture_scaled (GObject *source_object,
{
g_debug ("Ignored URL '%s' as it's a screenshot from gnome-screenshot",
cc_background_item_get_uri (item));
- g_object_unref (pixbuf);
- g_object_unref (item);
- return;
+ goto out;
}
cc_background_item_load (item, NULL);
@@ -189,8 +187,9 @@ picture_scaled (GObject *source_object,
GINT_TO_POINTER (TRUE));
- g_object_unref (pixbuf);
- g_object_unref (item);
+ out:
+ g_clear_object (&pixbuf);
+ g_clear_object (&item);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]