/soc/2013/ankitkv/gobjectification: 90850ff4b5eb: Backed out cha...

Ankit Vani a at nevitus.org
Wed Oct 2 16:45:47 EDT 2013


Changeset: 90850ff4b5eb7df9cda38033c703b59f37227191
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-03 02:08 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/90850ff4b5eb

Description:

Backed out changeset 348356cbc657

diffstat:

 ChangeLog.API                               |   1 -
 libpurple/connection.h                      |  14 ++++++++++++++
 libpurple/dbus-define-api.h                 |   1 +
 libpurple/protocols/bonjour/jabber.c        |   2 +-
 libpurple/protocols/gg/avatar.c             |   8 ++++----
 libpurple/protocols/gg/edisc.c              |   2 +-
 libpurple/protocols/gg/gg.c                 |   2 +-
 libpurple/protocols/gg/oauth/oauth-purple.c |   4 ++--
 libpurple/protocols/gg/pubdir-prpl.c        |   6 +++---
 libpurple/protocols/gg/roster.c             |   2 +-
 libpurple/protocols/jabber/auth.c           |   4 ++--
 libpurple/protocols/jabber/auth_cyrus.c     |   4 ++--
 libpurple/protocols/jabber/jabber.c         |  10 +++++-----
 libpurple/protocols/jabber/presence.c       |   4 ++--
 libpurple/protocols/msn/userlist.c          |   4 ++--
 libpurple/protocols/mxit/actions.c          |   4 ++--
 libpurple/protocols/mxit/login.c            |   2 +-
 libpurple/protocols/silc/silc.c             |   4 ++--
 libpurple/protocols/yahoo/libymsg.c         |   2 +-
 19 files changed, 47 insertions(+), 33 deletions(-)

diffs (truncated from 380 to 300 lines):

diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -303,7 +303,6 @@ version 3.0.0 (??/??/????):
 		* purple_connection_new_unregister
 		* purple_connection_destroy
 		* purple_connection_set_account
-		* PURPLE_CONNECTION_IS_VALID
 		* purple_contact_set_alias
 		* purple_conv_chat_set_users
 		* PurpleConversationType
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -483,6 +483,20 @@ GList *purple_connections_get_all(void);
  */
 GList *purple_connections_get_connecting(void);
 
+/**
+ * Checks if gc is still a valid pointer to a gc.
+ *
+ * @return @c TRUE if gc is valid.
+ *
+ * @deprecated Do not use this.  Instead, cancel your asynchronous request
+ *             when the PurpleConnection is destroyed.
+ */
+/*
+ * TODO: Eventually this bad boy will be removed, because it is
+ *       a gross fix for a crashy problem.
+ */
+#define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc)) != NULL)
+
 /*@}*/
 
 /**************************************************************************/
diff --git a/libpurple/dbus-define-api.h b/libpurple/dbus-define-api.h
--- a/libpurple/dbus-define-api.h
+++ b/libpurple/dbus-define-api.h
@@ -10,4 +10,5 @@ gboolean PURPLE_BUDDY_IS_ONLINE(PurpleBu
 
 /* connection.h */
 gboolean PURPLE_CONNECTION_IS_CONNECTED(PurpleConnection *connection);
+gboolean PURPLE_CONNECTION_IS_VALID(PurpleConnection *connection);
 
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c
--- a/libpurple/protocols/bonjour/jabber.c
+++ b/libpurple/protocols/bonjour/jabber.c
@@ -1151,7 +1151,7 @@ bonjour_jabber_close_conversation(Bonjou
 		BonjourData *bd = NULL;
 
 		PurpleConnection *pc = purple_account_get_connection(bconv->account);
-		if (PURPLE_IS_CONNECTION(pc)) {
+		if (PURPLE_CONNECTION_IS_VALID(pc)) {
 			bd = purple_connection_get_protocol_data(pc);
 			bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv);
 		}
diff --git a/libpurple/protocols/gg/avatar.c b/libpurple/protocols/gg/avatar.c
--- a/libpurple/protocols/gg/avatar.c
+++ b/libpurple/protocols/gg/avatar.c
@@ -127,7 +127,7 @@ static gboolean ggp_avatar_timer_cb(gpoi
 	PurpleConnection *gc = _gc;
 	ggp_avatar_session_data *avdata;
 	
-	g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), FALSE);
+	g_return_val_if_fail(PURPLE_CONNECTION_IS_VALID(gc), FALSE);
 	
 	avdata = ggp_avatar_get_avdata(gc);
 	if (avdata->current_update != NULL)
@@ -271,7 +271,7 @@ static void ggp_avatar_buddy_update_rece
 	const gchar *got_data;
 	size_t got_len;
 
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 	{
 		g_free(pending_update);
 		return;
@@ -330,7 +330,7 @@ void ggp_avatar_own_set(PurpleConnection
 {
 	ggp_avatar_own_data *own_data;
 	
-	if (!PURPLE_IS_CONNECTION(gc) || !PURPLE_CONNECTION_IS_CONNECTED(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc) || !PURPLE_CONNECTION_IS_CONNECTED(gc))
 		return;
 	
 	purple_debug_info("gg", "ggp_avatar_own_set(%p, %p)", gc, img);
@@ -396,7 +396,7 @@ static void ggp_avatar_own_sent(PurpleHt
 	PurpleConnection *gc =
 		purple_http_conn_get_purple_connection(http_conn);
 
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 		return;
 
 	if (!purple_http_response_is_successful(response)) {
diff --git a/libpurple/protocols/gg/edisc.c b/libpurple/protocols/gg/edisc.c
--- a/libpurple/protocols/gg/edisc.c
+++ b/libpurple/protocols/gg/edisc.c
@@ -100,7 +100,7 @@ ggp_edisc_get_sdata(PurpleConnection *gc
 {
 	GGPInfo *accdata;
 
-	g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL);
+	g_return_val_if_fail(PURPLE_CONNECTION_IS_VALID(gc), NULL);
 
 	accdata = purple_connection_get_protocol_data(gc);
 	g_return_val_if_fail(accdata != NULL, NULL);
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -407,7 +407,7 @@ void ggp_async_login_handler(gpointer _g
 	GGPInfo *info;
 	struct gg_event *ev;
 
-	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
 	info = purple_connection_get_protocol_data(gc);
 
diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c
--- a/libpurple/protocols/gg/oauth/oauth-purple.c
+++ b/libpurple/protocols/gg/oauth/oauth-purple.c
@@ -115,7 +115,7 @@ static void ggp_oauth_request_token_got(
 	gboolean succ = TRUE;
 	const gchar *xml_raw;
 
-	if (!PURPLE_IS_CONNECTION(data->gc))
+	if (!PURPLE_CONNECTION_IS_VALID(data->gc))
 	{
 		ggp_oauth_data_free(data);
 		return;
@@ -185,7 +185,7 @@ static void ggp_oauth_authorization_done
 	const char *url = "http://api.gadu-gadu.pl/access_token";
 	int response_code;
 
-	if (!PURPLE_IS_CONNECTION(data->gc))
+	if (!PURPLE_CONNECTION_IS_VALID(data->gc))
 	{
 		ggp_oauth_data_free(data);
 		return;
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -200,7 +200,7 @@ static void ggp_pubdir_get_info_got_toke
 	PurpleHttpRequest *req;
 	ggp_pubdir_request *request = _request;
 
-	if (!token || !PURPLE_IS_CONNECTION(gc))
+	if (!token || !PURPLE_CONNECTION_IS_VALID(gc))
 	{
 		request->cb(gc, -1, NULL, 0, request->user_data);
 		ggp_pubdir_request_free(request);
@@ -634,7 +634,7 @@ static void ggp_pubdir_search_got_token(
 	ggp_pubdir_request *request = _request;
 	gchar *query;
 
-	if (!token || !PURPLE_IS_CONNECTION(gc))
+	if (!token || !PURPLE_CONNECTION_IS_VALID(gc))
 	{
 		request->cb(gc, -1, NULL, 0, request->user_data);
 		ggp_pubdir_request_free(request);
@@ -911,7 +911,7 @@ static void ggp_pubdir_set_info_got_toke
 	gchar *name, *surname, *city;
 	uin_t uin = record->uin;
 
-	if (!token || !PURPLE_IS_CONNECTION(gc))
+	if (!token || !PURPLE_CONNECTION_IS_VALID(gc))
 	{
 		// TODO: notify about failure
 		ggp_pubdir_record_free(record, 1);
diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c
--- a/libpurple/protocols/gg/roster.c
+++ b/libpurple/protocols/gg/roster.c
@@ -189,7 +189,7 @@ static gboolean ggp_roster_timer_cb(gpoi
 {
 	PurpleConnection *gc = _gc;
 	
-	g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), FALSE);
+	g_return_val_if_fail(PURPLE_CONNECTION_IS_VALID(gc), FALSE);
 	
 	ggp_roster_send_update(gc);
 	
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
--- a/libpurple/protocols/jabber/auth.c
+++ b/libpurple/protocols/jabber/auth.c
@@ -94,7 +94,7 @@ auth_old_pass_cb(PurpleConnection *gc, P
 	gboolean remember;
 
 	/* The password prompt dialog doesn't get disposed if the account disconnects */
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 		return;
 
 	account = purple_connection_get_account(gc);
@@ -123,7 +123,7 @@ static void
 auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields)
 {
 	/* The password prompt dialog doesn't get disposed if the account disconnects */
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 		return;
 
 	/* Disable the account as the user has cancelled connecting */
diff --git a/libpurple/protocols/jabber/auth_cyrus.c b/libpurple/protocols/jabber/auth_cyrus.c
--- a/libpurple/protocols/jabber/auth_cyrus.c
+++ b/libpurple/protocols/jabber/auth_cyrus.c
@@ -134,7 +134,7 @@ static void auth_pass_cb(PurpleConnectio
 	gboolean remember;
 
 	/* The password prompt dialog doesn't get disposed if the account disconnects */
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 		return;
 
 	account = purple_connection_get_account(gc);
@@ -168,7 +168,7 @@ auth_no_pass_cb(PurpleConnection *gc, Pu
 	PurpleAccount *account;
 
 	/* The password prompt dialog doesn't get disposed if the account disconnects */
-	if (!PURPLE_IS_CONNECTION(gc))
+	if (!PURPLE_CONNECTION_IS_VALID(gc))
 		return;
 
 	account = purple_connection_get_account(gc);
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -596,7 +596,7 @@ void jabber_send_signal_cb(PurpleConnect
 	if (NULL == packet)
 		return;
 
-	g_return_if_fail(PURPLE_IS_CONNECTION(pc));
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(pc));
 
 	js = purple_connection_get_protocol_data(pc);
 
@@ -651,7 +651,7 @@ jabber_recv_cb_ssl(gpointer data, Purple
 	static char buf[4096];
 
 	/* TODO: It should be possible to make this check unnecessary */
-	if(!PURPLE_IS_CONNECTION(gc)) {
+	if(!PURPLE_CONNECTION_IS_VALID(gc)) {
 		purple_ssl_close(gsc);
 		g_return_if_reached();
 	}
@@ -688,7 +688,7 @@ jabber_recv_cb(gpointer data, gint sourc
 	int len;
 	static char buf[4096];
 
-	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
 	if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) {
 		purple_connection_update_last_received(gc);
@@ -746,7 +746,7 @@ jabber_login_callback_ssl(gpointer data,
 	JabberStream *js;
 
 	/* TODO: It should be possible to make this check unnecessary */
-	if(!PURPLE_IS_CONNECTION(gc)) {
+	if(!PURPLE_CONNECTION_IS_VALID(gc)) {
 		purple_ssl_close(gsc);
 		g_return_if_reached();
 	}
@@ -842,7 +842,7 @@ jabber_ssl_connect_failure(PurpleSslConn
 	JabberStream *js;
 
 	/* If the connection is already disconnected, we don't need to do anything else */
-	g_return_if_fail(PURPLE_IS_CONNECTION(gc));
+	g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
 
 	js = purple_connection_get_protocol_data(gc);
 	js->gsc = NULL;
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -387,7 +387,7 @@ struct _jabber_add_permit {
 static void authorize_add_cb(const char *message, gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_IS_CONNECTION(jap->gc))
+	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
 		jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc),
 			jap->who, "subscribed");
 	g_free(jap->who);
@@ -397,7 +397,7 @@ static void authorize_add_cb(const char 
 static void deny_add_cb(const char *message, gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_IS_CONNECTION(jap->gc))
+	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
 		jabber_presence_subscription_set(purple_connection_get_protocol_data(jap->gc),
 			jap->who, "unsubscribed");
 	g_free(jap->who);
diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c
--- a/libpurple/protocols/msn/userlist.c
+++ b/libpurple/protocols/msn/userlist.c
@@ -52,7 +52,7 @@ msn_accept_add_cb(const char *message, g
 
 	purple_debug_misc("msn", "Accepted the new buddy: %s\n", pa->who);
 



More information about the Commits mailing list