/soc/2015/jgeboski/facebook: ee2afb768c6e: facebook: fixed segfa...
James Geboski
jgeboski at gmail.com
Sat Aug 15 21:21:22 EDT 2015
Changeset: ee2afb768c6e73bd9dff28d97d09ae3c2d30fdd1
Author: James Geboski <jgeboski at gmail.com>
Date: 2015-08-15 20:30 -0400
Branch: facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/ee2afb768c6e
Description:
facebook: fixed segfault when marking conversations as read
diffstat:
libpurple/protocols/facebook/facebook.c | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diffs (74 lines):
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
@@ -644,6 +644,7 @@ fb_cb_conv_read(gpointer data)
FbApi *api;
FbData *fata;
FbId id;
+ gchar *tname;
PurpleConnection *gc;
PurpleConversation *conv = data;
@@ -652,7 +653,9 @@ fb_cb_conv_read(gpointer data)
name = purple_conversation_get_name(conv);
id = FB_ID_FROM_STR(name);
- fb_data_clear_timeout(fata, "conv-read", FALSE);
+ tname = g_strconcat("conv-read-", name, NULL);
+ fb_data_clear_timeout(fata, tname, FALSE);
+ g_free(tname);
if (!purple_conversation_has_focus(conv) ||
!fb_data_get_unread(fata, id))
@@ -670,7 +673,9 @@ static void
fb_cb_conv_updated(PurpleConversation *conv, PurpleConversationUpdateType type,
gpointer data)
{
+ const gchar *name;
FbData *fata = data;
+ gchar *tname;
PurpleAccount *acct;
acct = purple_conversation_get_account(conv);
@@ -679,12 +684,27 @@ fb_cb_conv_updated(PurpleConversation *c
purple_account_get_bool(acct, "mark-read", TRUE))
{
/* Use event loop for purple_conversation_has_focus() */
- fb_data_add_timeout(fata, "conv-read", 1, fb_cb_conv_read,
- conv);
+ name = purple_conversation_get_name(conv);
+ tname = g_strconcat("conv-read-", name, NULL);
+ fb_data_add_timeout(fata, tname, 1, fb_cb_conv_read, conv);
+ g_free(tname);
}
}
static void
+fb_cb_conv_deleting(PurpleConversation *conv, gpointer data)
+{
+ const gchar *name;
+ FbData *fata = data;
+ gchar *tname;
+
+ name = purple_conversation_get_name(conv);
+ tname = g_strconcat("conv-read-", name, NULL);
+ fb_data_clear_timeout(fata, tname, TRUE);
+ g_free(tname);
+}
+
+static void
fb_blist_chat_create(GSList *buddies, gpointer data)
{
const gchar *name;
@@ -825,6 +845,11 @@ fb_login(PurpleAccount *acct)
gc,
G_CALLBACK(fb_cb_conv_updated),
fata);
+ purple_signal_connect(convh,
+ "deleting-conversation",
+ gc,
+ G_CALLBACK(fb_cb_conv_deleting),
+ fata);
if (!fb_data_load(fata)) {
user = purple_account_get_username(acct);
More information about the Commits
mailing list