soc.2009.telepathy: 56ce04a8: Fixed memory leak and crash

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jun 2 15:20:30 EDT 2009


-----------------------------------------------------------------
Revision: 56ce04a82ed32fd25c4a93041494e527debb5d1d
Ancestor: f167404479292de9ed542f100d29c398b0d5853a
Author: sttwister at soc.pidgin.im
Date: 2009-06-02T18:08:30
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/56ce04a82ed32fd25c4a93041494e527debb5d1d

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

ChangeLog: 

Fixed memory leak and crash

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	4dcd78f9ae47e45cdc0488e1a761c3f9ede9aaaf
+++ libpurple/protocols/telepathy/telepathy.c	82021ad730e5ba0e4c5e21109a1d7b3afc8fa9d2
@@ -425,8 +425,6 @@ handle_new_channel (PurplePlugin* plugin
 	
 	purple_debug_info("telepathy", "New channel: %s\n", object_Path);
 
-	tp_asv_dump(map);
-
 	tp_channel_call_when_ready(channel, channel_ready_cb, plugin);
 }
 
@@ -548,7 +546,7 @@ status_changed_cb (TpConnection *proxy,
 		purple_connection_set_state(data->gc, PURPLE_CONNECTED);
 
 		data->text_Channels = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) destroy_text_channel);
-		data->contacts = g_hash_table_new(g_direct_hash, g_direct_equal);
+		data->contacts = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
 	}
 	else if (arg_Status == TP_CONNECTION_STATUS_DISCONNECTED)
 	{
@@ -556,7 +554,8 @@ status_changed_cb (TpConnection *proxy,
 		PurpleConnectionError error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 		purple_debug_info("telepathy", "Disconnected! Reason: %d\n", arg_Reason);
 
-		purple_connection_set_state(data->gc, PURPLE_DISCONNECTED);
+		if (data->gc)
+			purple_connection_set_state(data->gc, PURPLE_DISCONNECTED);
 
 		switch (arg_Reason)
 		{
@@ -621,7 +620,7 @@ status_changed_cb (TpConnection *proxy,
 			break;
 		}
 
-		if (reason != NULL)
+		if (reason != NULL && data->gc)
 			purple_connection_error_reason(data->gc, error, reason);
 
 		if (data->connection)
@@ -797,6 +796,7 @@ telepathy_close(PurpleConnection *gc)
 		tp_cli_connection_call_disconnect(data->connection, -1, NULL, NULL, NULL, NULL);
 		g_object_unref(data->connection);
 		data->connection = NULL;
+		data->gc = NULL;
 	}
 
 	g_hash_table_destroy(data->text_Channels);


More information about the Commits mailing list