Merge lp://qastaging/~mterry/libdbusmenu/unref-gtkmenuitems into lp://qastaging/libdbusmenu/0.5

Proposed by Michael Terry
Status: Merged
Approved by: Ted Gould
Approved revision: 341
Merged at revision: 342
Proposed branch: lp://qastaging/~mterry/libdbusmenu/unref-gtkmenuitems
Merge into: lp://qastaging/libdbusmenu/0.5
Diff against target: 40 lines (+14/-6)
1 file modified
libdbusmenu-gtk/client.c (+14/-6)
To merge this branch: bzr merge lp://qastaging/~mterry/libdbusmenu/unref-gtkmenuitems
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+78156@code.qastaging.launchpad.net

Description of the change

Another result of my investigations into bug 835646. I don't think this is the last leak, but it should help a bit.

GtkMenuItems weren't necessarily being finalized, because we would still hold a reference to them.

dbusmenu_gtkclient_newitem_base would always call g_object_ref_sink, owning the initial floating ref. Then the menu item would often be added to a menu, which would call ref_sink again, adding a normal ref (total of 2 now).

When the corresponding DbusmenuMenuitem would die, we used to just be calling gtk_widget_destroy, which removes the item from any containers and does some other cleanups. Being unparented would reduce the ref count to 1, where it would remain.

So I've added another g_object_unref call to match our initial ref_sink. And some comments to explain why.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches