[Pidgin] #12597: No API to free resources allocated during blist_node_menu/purple_menu_action_new()
Pidgin
trac at pidgin.im
Sun Sep 5 13:19:50 EDT 2010
#12597: No API to free resources allocated during
blist_node_menu/purple_menu_action_new()
--------------------+-------------------------------------------------------
Reporter: stefanb | Type: enhancement
Status: new | Component: libpurple
Version: 2.7.3 | Keywords:
--------------------+-------------------------------------------------------
If a protocol plugin calls purple_menu_action_new() during the
blist_node_menu callback and allocates memory for the menu callback data
then there will memory leaked every time the buddy list menu is
constructed.
pidgin calls purple_menu_action_free() for each menu entry after
constructing the corresponding GTK menu widget. But
purple_menu_action_free() only frees the strdup'd label and the
PurpleMenuAction itself, nothing else.
The API documentation doesn't mention that it is not allowed to allocate
resources for a call to purple_menu_action_new().
One example where this happens is with the pidgin-sipe protocol plugin on
OCS2007 servers. In this setup it will dynamically generate Access Level
menu entries which have data structures allocated for the menu callback.
Two ideas for an API:
- add an optional "free resources" callback to a new version of
purple_menu_action_new(). When the libpurple client destroys the buddy
list menu it could then execute the callback for those menu entries that
define one
- add a new protocol plugin callback to release resource allocated by
blist_node_menu callback. The protocol plugin would then be responsible to
gather the information about allocated resources in a separate list
assigned to the account. After the libpurple client is finished with the
menu it would then execute this new "blist_node_menu_free" callback so
that the protocol plugin can free the resources.
--
Ticket URL: <http://developer.pidgin.im/ticket/12597>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list