changeset 16080:ed2e53708b16

Fix Bug #125 (Perl plugins using timeouts not having timeouts unregistered when plugin unloaded)
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 13 Apr 2007 02:37:56 +0000
parents 6dedf7542b44
children 306b2f0143f8
files libpurple/plugins/perl/perl-handlers.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/perl-handlers.c	Fri Apr 13 01:57:16 2007 +0000
+++ b/libpurple/plugins/perl/perl-handlers.c	Fri Apr 13 02:37:56 2007 +0000
@@ -183,6 +183,9 @@
 {
 	timeout_handlers = g_list_remove(timeout_handlers, handler);
 
+	if (handler->iotag > 0)
+		g_source_remove(handler->iotag);
+
 	if (handler->callback != NULL)
 		SvREFCNT_dec(handler->callback);
 
@@ -207,7 +210,7 @@
 	g_free(handler);
 }
 
-static int
+static gboolean
 perl_timeout_cb(gpointer data)
 {
 	PurplePerlTimeoutHandler *handler = (PurplePerlTimeoutHandler *)data;
@@ -225,9 +228,12 @@
 	FREETMPS;
 	LEAVE;
 
+	/* We're returning FALSE, so no need to manually remove the source */
+	handler->iotag = 0;
+
 	destroy_timeout_handler(handler);
 
-	return 0;
+	return FALSE;
 }
 
 typedef void *DATATYPE;