/soc/2013/ankitkv/gobjectification: 304912384a5c: Free actions o...

Ankit Vani a at nevitus.org
Thu Aug 8 13:22:34 EDT 2013


Changeset: 304912384a5c49befdf8a99572d109a8d53ac190
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-08 22:52 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/304912384a5c

Description:

Free actions on plugin unload, and updated documentation

diffstat:

 libpurple/plugins.c |  8 ++++++++
 libpurple/plugins.h |  2 +-
 libpurple/prpl.h    |  3 ++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diffs (54 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -118,10 +118,13 @@ purple_plugin_unload(PurplePlugin *plugi
 {
 #ifdef PURPLE_PLUGINS
 	GError *error = NULL;
+	PurplePluginInfoPrivate *priv;
 
 	g_return_val_if_fail(plugin != NULL, FALSE);
 	g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE);
 
+	priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(purple_plugin_get_info(plugin));
+
 	purple_debug_info("plugins", "Unloading plugin %s\n",
 			purple_plugin_get_filename(plugin));
 
@@ -138,6 +141,11 @@ purple_plugin_unload(PurplePlugin *plugi
 
 	purple_signals_disconnect_by_handle(plugin);
 
+	while (priv->actions) {
+		g_boxed_free(PURPLE_TYPE_PLUGIN_ACTION, priv->actions->data);
+		priv->actions = g_list_delete_link(priv->actions, priv->actions);
+	}
+
 	loaded_plugins     = g_list_remove(loaded_plugins, plugin);
 	plugins_to_disable = g_list_remove(plugins_to_disable, plugin);
 
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -208,7 +208,7 @@ G_BEGIN_DECLS
 gboolean purple_plugin_load(PurplePlugin *plugin);
 
 /**
- * Unloads the specified plugin.
+ * Unloads the specified plugin, and frees associated actions.
  *
  * @param plugin The plugin handle.
  *
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -1000,7 +1000,8 @@ PurplePluginProtocolInfo *purple_find_pr
 gboolean purple_protocols_add(PurplePluginProtocolInfo *prpl_info);
 
 /** TODO A sanity check is needed
- * Removes a protocol from the list of protocols.
+ * Removes a protocol from the list of protocols, and frees its user splits,
+ * protocol options, and actions.
  *
  * @param prpl_info  The protocol to remove.
  *



More information about the Commits mailing list