/soc/2015/jgeboski/facebook: 8cf22d7f1c83: facebook: fixed a sle...

James Geboski jgeboski at gmail.com
Fri Aug 7 18:36:29 EDT 2015


Changeset: 8cf22d7f1c83b725e5b98665fc4df5a02708dfbd
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-08-07 18:35 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/8cf22d7f1c83

Description:

facebook: fixed a slew of issues with room lists

This addresses:
  - Canceled requests leading to warnings spewing
  - Doubly freeing the PurpleRoomlist
  - More than one PurpleRoomlist leaking
  - Progress always being FALSE

diffstat:

 libpurple/protocols/facebook/data.c     |   4 ----
 libpurple/protocols/facebook/facebook.c |  10 ++++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (55 lines):

diff --git a/libpurple/protocols/facebook/data.c b/libpurple/protocols/facebook/data.c
--- a/libpurple/protocols/facebook/data.c
+++ b/libpurple/protocols/facebook/data.c
@@ -57,10 +57,6 @@ fb_data_dispose(GObject *obj)
 		g_object_unref(priv->api);
 	}
 
-	if (priv->roomlist != NULL) {
-		g_object_unref(priv->roomlist);
-	}
-
 	g_hash_table_destroy(priv->icons);
 	g_hash_table_destroy(priv->icona);
 }
diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -369,6 +369,11 @@ fb_cb_api_thread_list(FbApi *api, GSList
 	PurpleRoomlistRoom *room;
 
 	list = fb_data_get_roomlist(fata);
+
+	if (G_UNLIKELY(list == NULL)) {
+		return;
+	}
+
 	gstr = g_string_new(NULL);
 
 	for (l = thrds; l != NULL; l = l->next) {
@@ -394,6 +399,7 @@ fb_cb_api_thread_list(FbApi *api, GSList
 	}
 
 	purple_roomlist_set_in_progress(list, FALSE);
+	fb_data_set_roomlist(fata, NULL);
 	g_string_free(gstr, TRUE);
 }
 
@@ -852,6 +858,9 @@ fb_roomlist_get_list(PurpleConnection *g
 	PurpleRoomlistField *fld;
 
 	fata = purple_connection_get_protocol_data(gc);
+	list = fb_data_get_roomlist(fata);
+	g_return_val_if_fail(list == NULL, NULL);
+
 	api = fb_data_get_api(fata);
 	acct = purple_connection_get_account(gc);
 	list = purple_roomlist_new(acct);
@@ -868,6 +877,7 @@ fb_roomlist_get_list(PurpleConnection *g
 	flds = g_list_reverse(flds);
 	purple_roomlist_set_fields(list, flds);
 
+	purple_roomlist_set_in_progress(list, TRUE);
 	fb_api_thread_list(api);
 	return list;
 }



More information about the Commits mailing list