/soc/2013/ankitkv/gobjectification: 27fb01531390: Destroy option...

Ankit Vani a at nevitus.org
Mon Aug 5 17:42:39 EDT 2013


Changeset: 27fb0153139014805f1d3916aa0c7ef0e4ab986a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-06 03:11 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/27fb01531390

Description:

Destroy options, splits and actions when a protocol is removed

diffstat:

 libpurple/prpl.c |  23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diffs (40 lines):

diff --git a/libpurple/prpl.c b/libpurple/prpl.c
--- a/libpurple/prpl.c
+++ b/libpurple/prpl.c
@@ -21,6 +21,7 @@
  *
  */
 #include "internal.h"
+#include "accountopt.h"
 #include "conversation.h"
 #include "debug.h"
 #include "network.h"
@@ -661,6 +662,28 @@ gboolean purple_protocols_remove(PurpleP
 	if (purple_find_protocol_info(prpl_info->id) == NULL)
 		return FALSE;
 
+	while (prpl_info->user_splits) {
+		PurpleAccountUserSplit *split = prpl_info->user_splits->data;
+		purple_account_user_split_destroy(split);
+		prpl_info->user_splits = g_list_delete_link(prpl_info->user_splits,
+				prpl_info->user_splits);
+	}
+
+	while (prpl_info->protocol_options) {
+		PurpleAccountOption *option = prpl_info->protocol_options->data;
+		purple_account_option_destroy(option);
+		prpl_info->protocol_options =
+				g_list_delete_link(prpl_info->protocol_options,
+				prpl_info->protocol_options);
+	}
+
+	while (prpl_info->actions) {
+		PurpleProtocolAction *action = prpl_info->actions->data;
+		g_free(action->label);
+		prpl_info->actions = g_list_delete_link(prpl_info->actions,
+				prpl_info->actions);
+	}
+
 	g_hash_table_remove(protocols, prpl_info->id);
 	return TRUE;
 }



More information about the Commits mailing list