[telepathy-account-widgets] avatar-chooser: Don't call clear_image() from ::init()
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [telepathy-account-widgets] avatar-chooser: Don't call clear_image() from ::init()
- Date: Fri, 31 Jul 2015 19:01:21 +0000 (UTC)
commit 45e652fd6a56b133f10d82ef6a06a5c3a1f505f1
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu Jul 30 11:21:28 2015 +0200
avatar-chooser: Don't call clear_image() from ::init()
GtkButton currently has a bug where calling gtk_button_set_image() in
the ::init() vfunc of a subclass will cause the GtkImage to be leaked.
This bug does not happen if the image is set after the GtkButton has
been constructed, so this commit moves the call to
avatar_chooser_clear_image() (which calls gtk_button_set_image()) from
::init() to ::constructed().
See https://bugzilla.gnome.org/show_bug.cgi?id=753048
This fixes:
==388== 768 (304 direct, 464 indirect) bytes in 1 blocks are definitely lost in loss record 33,655 of 34,
==388== at 0x8792D9C: g_type_create_instance (gtype.c:1849)
==388== by 0x8779AC5: g_object_new_internal (gobject.c:1774)
==388== by 0x8779FD4: g_object_newv (gobject.c:1921)
==388== by 0x8779676: g_object_new (gobject.c:1614)
==388== by 0x7453142: gtk_image_new_from_icon_name (gtkimage.c:792)
==388== by 0x4CC2CEE: avatar_chooser_clear_image (tpaw-avatar-chooser.c:394)
==388== by 0x4CC45AA: tpaw_avatar_chooser_init (tpaw-avatar-chooser.c:1195)
==388== by 0x8792E7D: g_type_create_instance (gtype.c:1870)
==388== by 0x8779AC5: g_object_new_internal (gobject.c:1774)
==388== by 0x877A71A: g_object_new_valist (gobject.c:2033)
==388== by 0x87796C5: g_object_new (gobject.c:1617)
==388== by 0x4CC4673: tpaw_avatar_chooser_new (tpaw-avatar-chooser.c:1213)
==388== by 0x4CD41D2: tpaw_user_info_constructed (tpaw-user-info.c:543)
==388== by 0x8779C10: g_object_new_internal (gobject.c:1814)
==388== by 0x877A71A: g_object_new_valist (gobject.c:2033)
==388== by 0x87796C5: g_object_new (gobject.c:1617)
==388== by 0x4CD4826: tpaw_user_info_new (tpaw-user-info.c:663)
==388== by 0x4C97906: edit_personal_details (goatelepathyprovider.c:667)
==388== by 0x4C980A7: edit_personal_details_clicked_cb (goatelepathyprovider.c:859)
==388== by 0x877427D: g_cclosure_marshal_VOID__VOIDv (gmarshal.c:905)
==388== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==388== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
==388== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==388== by 0x7326A22: gtk_button_clicked (gtkbutton.c:1488)
==388== by 0x7327943: gtk_button_do_release (gtkbutton.c:1899)
==388== by 0x7327D22: gtk_real_button_released (gtkbutton.c:2017)
==388== by 0x877427D: g_cclosure_marshal_VOID__VOIDv (gmarshal.c:905)
==388== by 0x877190F: g_type_class_meta_marshalv (gclosure.c:1021)
==388== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==388== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
==388== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==388== by 0x73244D2: multipress_released_cb (gtkbutton.c:613)
==388== by 0x36E5A05DAF: ffi_call_unix64 (unix64.S:76)
==388== by 0x36E5A05817: ffi_call (ffi64.c:525)
==388== by 0x8772F7C: g_cclosure_marshal_generic_va (gclosure.c:1594)
==388== by 0x87714D1: _g_closure_invoke_va (gclosure.c:864)
==388== by 0x878C771: g_signal_emit_valist (gsignal.c:3246)
==388== by 0x878D8E9: g_signal_emit (gsignal.c:3393)
==388== by 0x7421792: gtk_gesture_multi_press_end (gtkgesturemultipress.c:273)
==388== by 0x8775B90: g_cclosure_marshal_VOID__BOXEDv (gmarshal.c:1950)
https://bugzilla.gnome.org/show_bug.cgi?id=752938
tp-account-widgets/tpaw-avatar-chooser.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/tp-account-widgets/tpaw-avatar-chooser.c b/tp-account-widgets/tpaw-avatar-chooser.c
index c2f3422..59e5149 100644
--- a/tp-account-widgets/tpaw-avatar-chooser.c
+++ b/tp-account-widgets/tpaw-avatar-chooser.c
@@ -186,6 +186,12 @@ avatar_chooser_constructed (GObject *object)
G_OBJECT_CLASS (tpaw_avatar_chooser_parent_class)->constructed (object);
+ /* This cannot be called from _init() as this would cause a memory leak with
+ * gtk+ <= 3.17 (and maybe with newer), see this gtk+ bug:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=753048
+ */
+ avatar_chooser_clear_image (self);
+
tp_account_get_avatar_async (self->priv->account,
get_avatar_cb, tp_weak_ref_new (self, NULL, NULL));
@@ -1191,8 +1197,6 @@ tpaw_avatar_chooser_init (TpawAvatarChooser *self)
g_signal_connect (self, "clicked",
G_CALLBACK (avatar_chooser_clicked_cb),
self);
-
- avatar_chooser_clear_image (self);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]