2003-10-02 Mikael Hallendal <micke@imendio.com>
authorhallski <hallski>
Thu, 02 Oct 2003 08:42:57 +0000
changeset 43 66ff4339e06e
parent 42 26a101222a6f
child 44 988ac692303a
2003-10-02 Mikael Hallendal <micke@imendio.com> * loudmouth/lm-connection.c: (connection_free): - Free the message handlers and message handler list when free'ing the connection.
ChangeLog
loudmouth/lm-connection.c
--- a/ChangeLog	Wed Oct 01 13:58:53 2003 +0000
+++ b/ChangeLog	Thu Oct 02 08:42:57 2003 +0000
@@ -1,3 +1,9 @@
+2003-10-02  Mikael Hallendal  <micke@imendio.com>
+
+	* loudmouth/lm-connection.c: (connection_free):
+	- Free the message handlers and message handler list when free'ing 
+	  the connection.
+
 2003-10-01  Mikael Hallendal  <micke@imendio.com>
 
 	* configure.in: Tweaked the --with-ssl option a bit.
--- 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);
 	}