# HG changeset patch
# User Sadrul Habib Chowdhury <imadil@gmail.com>
# Date 1256406390 0
# Node ID f0d103b366df35ed4783908981b1119736f86869
# Parent  3a8d2927dc2be1668efd934a10fde951a5a7e5bc
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.

diff -r 3a8d2927dc2b -r f0d103b366df libpurple/plugins/perl/perl-handlers.c
--- 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);
 }