pidgin: 9ea18e61: pidgin: Fix a crash when accessing the S...
malu at pidgin.im
malu at pidgin.im
Wed May 19 14:50:41 EDT 2010
-----------------------------------------------------------------
Revision: 9ea18e61bbc3a4108d020e8b1c3352ff2c3b2cd1
Ancestor: 3347ceed452ea6d98397bdbb3b9bea6ea4832876
Author: malu at pidgin.im
Date: 2010-05-19T18:47:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9ea18e61bbc3a4108d020e8b1c3352ff2c3b2cd1
Modified files:
ChangeLog pidgin/gtkblist.c
ChangeLog:
pidgin: Fix a crash when accessing the Set Moods tool menu when having
disconnected mood-capable accounts.
Fixes #11946
-------------- next part --------------
============================================================
--- ChangeLog ab48bdc5cd7f93f29e9e6a633bfbb95de14ad3c2
+++ ChangeLog 0fdaf22ae17653e9537a18a175a375002f6294b9
@@ -6,6 +6,7 @@ version 2.7.1 (??/??/????):
Pidgin:
* Restore the tray icon's blinking functionality.
+ * Fix a crash setting moods when an account is disconnected.
Bonjour:
* Fix a crash on disconnect.
============================================================
--- pidgin/gtkblist.c cbe664829ff51113e1fda2ec2c6f1791a3b46c47
+++ pidgin/gtkblist.c 13c1e422e251a301e1e938bcdcc4baa3f3f94fd5
@@ -3487,29 +3487,31 @@ get_global_moods(void)
for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
PurpleAccount *account = (PurpleAccount *) accounts->data;
- PurpleConnection *gc = purple_account_get_connection(account);
+ if (purple_account_is_connected(account)) {
+ PurpleConnection *gc = purple_account_get_connection(account);
- if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
- PurplePluginProtocolInfo *prpl_info =
- PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
- PurpleMood *mood = NULL;
+ if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
+ PurplePluginProtocolInfo *prpl_info =
+ PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+ PurpleMood *mood = NULL;
- /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't
- * have get_moods, so using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC isn't necessary
- * here */
- for (mood = prpl_info->get_moods(account) ;
- mood->mood != NULL ; mood++) {
- int mood_count =
- GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood));
+ /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't
+ * have get_moods, so using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC isn't necessary
+ * here */
+ for (mood = prpl_info->get_moods(account) ;
+ mood->mood != NULL ; mood++) {
+ int mood_count =
+ GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood));
- if (!g_hash_table_lookup(global_moods, mood->mood)) {
- g_hash_table_insert(global_moods, (gpointer)mood->mood, mood);
+ if (!g_hash_table_lookup(global_moods, mood->mood)) {
+ g_hash_table_insert(global_moods, (gpointer)mood->mood, mood);
+ }
+ g_hash_table_insert(mood_counts, (gpointer)mood->mood,
+ GINT_TO_POINTER(mood_count + 1));
}
- g_hash_table_insert(mood_counts, (gpointer)mood->mood,
- GINT_TO_POINTER(mood_count + 1));
- }
- num_accounts++;
+ num_accounts++;
+ }
}
}
@@ -3547,8 +3549,9 @@ get_global_mood_status(void)
for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
PurpleAccount *account = (PurpleAccount *) accounts->data;
- if (purple_account_get_connection(account)->flags &
- PURPLE_CONNECTION_SUPPORT_MOODS) {
+ if (purple_account_is_connected(account) &&
+ (purple_account_get_connection(account)->flags &
+ PURPLE_CONNECTION_SUPPORT_MOODS)) {
PurplePresence *presence = purple_account_get_presence(account);
PurpleStatus *status = purple_presence_get_status(presence, "mood");
const gchar *curr_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
More information about the Commits
mailing list