After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695965 - [a11] memory leak in GtkTreeViewAccessible
[a11] memory leak in GtkTreeViewAccessible
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Accessibility
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 722030 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-03-16 14:03 UTC by Xan Lopez
Modified: 2014-03-26 23:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix memory leak (revised) (1.97 KB, patch)
2014-02-21 02:53 UTC, John Lindgren
none Details | Review

Description Xan Lopez 2013-03-16 14:03:24 UTC
==29897== 974 (160 direct, 814 indirect) bytes in 1 blocks are definitely lost in loss record 11,318 of 11,645
==29897==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==29897==    by 0x7D8275E: g_malloc (gmem.c:159)
==29897==    by 0x7D9B005: g_slice_alloc (gslice.c:1003)
==29897==    by 0x7D9B045: g_slice_alloc0 (gslice.c:1029)
==29897==    by 0x7D03864: g_type_create_instance (gtype.c:1892)
==29897==    by 0x7CE9EE5: g_object_constructor (gobject.c:1855)
==29897==    by 0x7CE96FD: g_object_newv (gobject.c:1719)
==29897==    by 0x7CE9E76: g_object_new_valist (gobject.c:1836)
==29897==    by 0x7CE9111: g_object_new (gobject.c:1551)
==29897==    by 0x77B5141: gtk_renderer_cell_accessible_new (gtkrenderercellaccessible.c:120)
==29897==    by 0x77C0AD8: create_cell (gtktreeviewaccessible.c:405)
==29897==    by 0x77C3B27: _gtk_tree_view_accessible_add_state (gtktreeviewaccessible.c:1933)
==29897==    by 0x771A1D2: gtk_tree_view_real_set_cursor (gtktreeview.c:13235)
==29897==    by 0x771A5E3: gtk_tree_view_set_cursor_on_cell (gtktreeview.c:13360)
==29897==    by 0x771A355: gtk_tree_view_set_cursor (gtktreeview.c:13305)
==29897==    by 0x74FEC2A: gtk_entry_completion_insert_action (gtkentrycompletion.c:1310)
==29897==    by 0x74FED6A: gtk_entry_completion_insert_action_text (gtkentrycompletion.c:1340)
==29897==    by 0x44C292: add_completion_actions (ephy-location-controller.c:286)
==29897==    by 0x44C578: ephy_location_controller_constructed (ephy-location-controller.c:373)
==29897==    by 0x7CE9812: g_object_newv (gobject.c:1747)
Comment 1 William Jon McCann 2014-02-21 02:04:45 UTC
*** Bug 722030 has been marked as a duplicate of this bug. ***
Comment 4 John Lindgren 2014-02-21 02:53:38 UTC
Created attachment 269870 [details] [review]
Fix memory leak (revised)

The GtkCellAccessible passed into cell_info_new() already has a reference count from when it was created, so calling g_object_ref() in cell_info_new() is unnecessary and causes a memory leak (bugs #695965 and #722030).

However, some GtkCellAccessibles get added to an AtkRelation as children of another cell, and when the parent cell is finalized, g_object_unref() gets called on the child (see gtk_cell_accessible_object_finalize()).  7a411eb6 did not account for this and so caused a crash in the case of hierarchical trees.  The fix is to remove the g_object_ref() from cell_info_new() as before but add a replacement g_object_ref() in create_cell() only when adding the cell to an AtkRelation.
Comment 5 John Lindgren 2014-03-26 14:48:27 UTC
And now gtk_cell_accessible_object_finalize() has been removed in commit fef14e0e87d2 (bug #726838).  So I believe the original patch on #722030, which was reverted, should be reinstated.
Comment 6 Benjamin Otte (Company) 2014-03-26 21:15:55 UTC
The patch is included in git master, isn't it?
Though I think talking about bug 722030 is quite useless now that the large refactoring of the refcounting happened.

In fact, I think this bug should be closed because the memleak is gone. Or isn't it?
Comment 7 John Lindgren 2014-03-26 22:26:22 UTC
Aha, I see that the change was made (again) as part of commit af4b26f5812b.  This bug can be closed; I just tested Git master and the memory leak is gone.  Thank you!