soc.2009.telepathy: eceff070: Fixed memory leak and bug causing endles...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jun 2 18:11:01 EDT 2009


-----------------------------------------------------------------
Revision: eceff070b74ca40fd80266ab1eacc8ba2e43ca13
Ancestor: 1097472cda972a28742aeb51e9797c1a54bceb56
Author: sttwister at soc.pidgin.im
Date: 2009-06-02T22:09:11
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/eceff070b74ca40fd80266ab1eacc8ba2e43ca13

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Fixed memory leak and bug causing endless loop on closing

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	d3eba8fb63b51ce298bfb2ee5f23cf3925e65a7b
+++ libpurple/protocols/telepathy/telepathy.c	f6aeb64609c74451bb59dd56b15d21f9a9574a68
@@ -562,9 +562,6 @@ status_changed_cb (TpConnection *proxy,
 		PurpleConnectionError error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 		purple_debug_info("telepathy", "Disconnected! Reason: %d\n", arg_Reason);
 
-		if (data->gc)
-			purple_connection_set_state(data->gc, PURPLE_DISCONNECTED);
-
 		switch (arg_Reason)
 		{
 			case TP_CONNECTION_STATUS_REASON_NETWORK_ERROR:
@@ -637,6 +634,17 @@ status_changed_cb (TpConnection *proxy,
 			data->connection = NULL;
 		}
 
+		if (data->text_Channels != NULL)
+		{
+			g_hash_table_destroy(data->text_Channels);
+			data->text_Channels = NULL;
+		}
+		if (data->contacts != NULL)
+		{
+			g_hash_table_destroy(data->contacts);
+			data->contacts = NULL;
+		}
+
 	}
 	else if (arg_Status == TP_CONNECTION_STATUS_CONNECTING)
 	{
@@ -809,8 +817,16 @@ telepathy_close(PurpleConnection *gc)
 		data->gc = NULL;
 	}
 
-	g_hash_table_destroy(data->text_Channels);
-	g_hash_table_destroy(data->contacts);
+	if (data->text_Channels != NULL)
+	{
+		g_hash_table_destroy(data->text_Channels);
+		data->text_Channels = NULL;
+	}
+	if (data->contacts != NULL)
+	{
+		g_hash_table_destroy(data->contacts);
+		data->contacts = NULL;
+	}
 }
 
 static void


More information about the Commits mailing list