[gnome-photos] embed: Don't leak self when load_show_id is removed before the timeout
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] embed: Don't leak self when load_show_id is removed before the timeout
- Date: Tue, 22 Mar 2016 09:58:31 +0000 (UTC)
commit 29ff483467e8a6f62ee7d593b7ef3e429b93918b
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Mar 18 19:41:51 2016 +0100
embed: Don't leak self when load_show_id is removed before the timeout
We were dropping the reference only in the timeout handler. That means
we were leaking it if the source was removed before the handler got
run. Tying it more tightly to the GSource with a GDestroyNotify solves
this problem.
https://bugzilla.gnome.org/show_bug.cgi?id=763908
src/photos-embed.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 4a4c5ab..9cb7c83 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -343,7 +343,6 @@ photos_embed_load_show_timeout (gpointer user_data)
self->load_show_id = 0;
photos_spinner_box_start (PHOTOS_SPINNER_BOX (self->spinner_box));
- g_object_unref (self);
return G_SOURCE_REMOVE;
}
@@ -352,7 +351,11 @@ static void
photos_embed_load_started (PhotosEmbed *self, PhotosBaseItem *item)
{
photos_embed_clear_load_timer (self);
- self->load_show_id = g_timeout_add (400, photos_embed_load_show_timeout, g_object_ref (self));
+ self->load_show_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
+ 400,
+ photos_embed_load_show_timeout,
+ g_object_ref (self),
+ g_object_unref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]