pidgin: 122423d4: Cleanup the code surrounding gc->disconn...
markdoliner at pidgin.im
markdoliner at pidgin.im
Thu Jun 18 15:40:28 EDT 2009
-----------------------------------------------------------------
Revision: 122423d4fe4c241200a641aaf426ca729142bfb0
Ancestor: fab36115790893ef93e44cb1afb36147965f6fe5
Author: markdoliner at pidgin.im
Date: 2009-06-18T19:36:46
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/122423d4fe4c241200a641aaf426ca729142bfb0
Modified files:
libpurple/connection.c
ChangeLog:
Cleanup the code surrounding gc->disconnect_timeout and set it to 0
in the timer callback function to avoid trying to remove the timer
after it's been triggered. The callback function returns FALSE to
remove the timer.
-------------- next part --------------
============================================================
--- libpurple/connection.c ec41b43bf2e770101bac748831341a3afb34c0fe
+++ libpurple/connection.c cd970c06856c25a8bc6fcf84ffc4508ea43eb7a6
@@ -309,7 +309,7 @@ _purple_connection_destroy(PurpleConnect
g_free(gc->password);
g_free(gc->display_name);
- if (gc->disconnect_timeout)
+ if (gc->disconnect_timeout > 0)
purple_timeout_remove(gc->disconnect_timeout);
PURPLE_DBUS_UNREGISTER_POINTER(gc);
@@ -515,11 +515,20 @@ purple_connection_disconnect_cb(gpointer
static gboolean
purple_connection_disconnect_cb(gpointer data)
{
- PurpleAccount *account = data;
- char *password = g_strdup(purple_account_get_password(account));
+ PurpleAccount *account;
+ PurpleConnection *gc;
+ char *password;
+
+ account = data;
+ gc = purple_account_get_connection(account);
+
+ gc->disconnect_timeout = 0;
+
+ password = g_strdup(purple_account_get_password(account));
purple_account_disconnect(account);
purple_account_set_password(account, password);
g_free(password);
+
return FALSE;
}
@@ -564,7 +573,7 @@ purple_connection_error_reason (PurpleCo
}
/* If we've already got one error, we don't need any more */
- if (gc->disconnect_timeout)
+ if (gc->disconnect_timeout > 0)
return;
gc->wants_to_die = purple_connection_error_is_fatal (reason);
More information about the Commits
mailing list