loudmouth/lm-connection.c
changeset 43 66ff4339e06e
parent 40 a6c68984c06a
child 47 b633605d7428
--- a/loudmouth/lm-connection.c	Wed Oct 01 13:58:53 2003 +0000
+++ b/loudmouth/lm-connection.c	Thu Oct 02 08:42:57 2003 +0000
@@ -171,9 +171,27 @@
 static void
 connection_free (LmConnection *connection)
 {
+	int i;
+
 	g_free (connection->server);
 
-	if (connection->io_channel) {
+	/* Unref handlers */
+	for (i = 0; i < LM_MESSAGE_TYPE_UNKNOWN; ++i) {
+		GSList *l;
+
+		for (l = connection->handlers[i]; l; l = l->next) {
+			HandlerData *hd = (HandlerData *) l->data;
+			
+			lm_message_handler_unref (hd->handler);
+			g_free (hd);
+		}
+
+		g_slist_free (connection->handlers[i]);
+	}
+
+	g_hash_table_destroy (connection->id_handlers);
+	
+	if (connection->is_open) {
 		connection_do_close (connection);
 	}