Leakage of Toolbar-Related Menu Items

Currently Gtk applications leak quite a lot when menu items are created
for GtkToolItems.  This is because circular links prevent the tear-down:

+-----------+ (menu_item)    +-----------+ (child)        +-------------+
+-----------+                +-----------+                +-------------+
                                   ^                             |
                                   |              (accel_widget) |

(That is going to look weird unless you use a fixed-width font.)

GtkToolItem is not a GtkWidget, so it doesn't receive the "destroy"
signal that normally helps tear down circular links.

This is bug 645483 with no responses.  I have contacted the author
who introduced the circularity,  jpetersen openismus com, but I
have received no response.

The question is what should be done about this.

1. Make the accel_widget link a weak ref.
2. Declare a destroy signal on GtkToolItem and make sure it gets
   sent by containers of such items, i.e., something parallel to
   GtkWidget's destroy.
3. Destroy the menuitem in GtkToolItem's dispose handler.  (And
   in one other place where we disown the current menu item.)

I don't really like version 1 because there are simply too many reasons
why the menu item would have extra refs.  That is, it would not work in

Other options?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]