[mutter/wip/bg-fixes: 2/5] background: fix pixbuf leak in load_file_finish
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/bg-fixes: 2/5] background: fix pixbuf leak in load_file_finish
- Date: Tue, 26 Mar 2013 17:47:58 +0000 (UTC)
commit 51326b11490dbef167b388b1dd3b3605dc910f08
Author: Ray Strode <rstrode redhat com>
Date: Sun Mar 24 23:53:15 2013 -0400
background: fix pixbuf leak in load_file_finish
g_task_propagate_pointer relinishes the GTask
of its reference to the propagated pointer, so we need to
unref it ourselves when we're done with it.
https://bugzilla.gnome.org/show_bug.cgi?id=696157
src/compositor/meta-background.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index f75d881..7d8f64c 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -1156,6 +1156,7 @@ meta_background_load_file_finish (MetaBackground *self,
int width, height, row_stride;
guchar *pixels;
gboolean has_alpha;
+ gboolean loaded = FALSE;
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
@@ -1164,7 +1165,7 @@ meta_background_load_file_finish (MetaBackground *self,
pixbuf = g_task_propagate_pointer (task, error);
if (pixbuf == NULL)
- return FALSE;
+ goto out;
task_data = g_task_get_task_data (task);
@@ -1190,7 +1191,7 @@ meta_background_load_file_finish (MetaBackground *self,
COGL_BITMAP_ERROR,
COGL_BITMAP_ERROR_FAILED,
_("background texture could not be created from file"));
- return FALSE;
+ goto out;
}
cogl_object_set_user_data (COGL_OBJECT (texture),
@@ -1206,8 +1207,12 @@ meta_background_load_file_finish (MetaBackground *self,
set_texture (self, texture);
clutter_content_invalidate (CLUTTER_CONTENT (self));
+ loaded = TRUE;
- return TRUE;
+out:
+ if (pixbuf != NULL)
+ g_object_unref (pixbuf);
+ return loaded;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]