# HG changeset patch # User Richard Laager # Date 1192408882 0 # Node ID 5915ad785ee771da41fc4e565d3812db0e12815c # Parent 93afdb7548cd9e4dbcc82dffede3a7f3922f2346 Add and call a purple_util_uninit() to free user_dir and customer_home_dir at shutdown. Fixes #3132 diff -r 93afdb7548cd -r 5915ad785ee7 ChangeLog.API --- a/ChangeLog.API Mon Oct 15 00:40:33 2007 +0000 +++ b/ChangeLog.API Mon Oct 15 00:41:22 2007 +0000 @@ -14,6 +14,8 @@ to unload a plugin--fails. This then prevents the plugin from being saved in the saved plugins list, so it'll won't be loaded at the next startup. + * purple_util_init() + * purple_util_uninit() * pidgin_dialogs_about_with_parent() * pidgin_log_show_contact_with_parent() diff -r 93afdb7548cd -r 5915ad785ee7 libpurple/core.c --- a/libpurple/core.c Mon Oct 15 00:40:33 2007 +0000 +++ b/libpurple/core.c Mon Oct 15 00:41:22 2007 +0000 @@ -94,6 +94,8 @@ /* The signals subsystem is important and should be first. */ purple_signals_init(); + purple_util_init(); + purple_signal_register(core, "uri-handler", purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, purple_value_new(PURPLE_TYPE_BOOLEAN), 3, @@ -229,6 +231,9 @@ #ifdef HAVE_DBUS purple_dbus_uninit(); #endif + + purple_util_uninit(); + purple_signals_uninit(); g_free(core->ui); diff -r 93afdb7548cd -r 5915ad785ee7 libpurple/util.c --- a/libpurple/util.c Mon Oct 15 00:40:33 2007 +0000 +++ b/libpurple/util.c Mon Oct 15 00:41:22 2007 +0000 @@ -70,6 +70,7 @@ static char *custom_user_dir = NULL; static char *user_dir = NULL; + PurpleMenuAction * purple_menu_action_new(const char *label, PurpleCallback callback, gpointer data, GList *children) @@ -91,6 +92,25 @@ g_free(act); } +void +purple_util_init(void) +{ + /* This does nothing right now. It exists for symmetry with + * purple_util_uninit() and forwards compatibility. */ +} + +void +purple_util_uninit(void) +{ + /* Free these so we don't have leaks at shutdown. */ + + g_free(custom_user_dir); + custom_user_dir = NULL; + + g_free(user_dir); + user_dir = NULL; +} + /************************************************************************** * Base16 Functions **************************************************************************/ diff -r 93afdb7548cd -r 5915ad785ee7 libpurple/util.h --- a/libpurple/util.h Mon Oct 15 00:40:33 2007 +0000 +++ b/libpurple/util.h Mon Oct 15 00:41:22 2007 +0000 @@ -86,6 +86,27 @@ void purple_menu_action_free(PurpleMenuAction *act); /**************************************************************************/ +/** @name Utility Subsystem */ +/**************************************************************************/ +/*@{*/ + +/** + * Initializes the utility subsystem. + * + * @since 2.3.0 + */ +void purple_util_init(void); + +/** + * Uninitializes the util subsystem. + * + * @since 2.3.0 + */ +void purple_util_uninit(void); + +/*@}*/ + +/**************************************************************************/ /** @name Base16 Functions */ /**************************************************************************/ /*@{*/