changeset 28427:f0d103b366df

Unregister commands registered by a perl-plugin when unloading it. A perl plugin may not unregister a command, and that can cause a crash. So the perl plugin loader will take care of unregistering the commands in case the plugin itself leaves them behind.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 24 Oct 2009 17:46:30 +0000
parents 3a8d2927dc2b
children 0849e1c20486
files libpurple/plugins/perl/perl-handlers.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/perl-handlers.c	Sat Oct 24 07:57:34 2009 +0000
+++ b/libpurple/plugins/perl/perl-handlers.c	Sat Oct 24 17:46:30 2009 +0000
@@ -649,6 +649,7 @@
 static void
 destroy_cmd_handler(PurplePerlCmdHandler *handler)
 {
+	purple_cmd_unregister(handler->id);
 	cmd_handlers = g_slist_remove(cmd_handlers, handler);
 
 	if (handler->callback != NULL)
@@ -705,7 +706,6 @@
 		return;
 	}
 
-	purple_cmd_unregister(id);
 	destroy_cmd_handler(handler);
 }