changeset 15426:7865f302c5fb

Remove the timeout-source to fix a possible crash.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 28 Jan 2007 18:19:20 +0000
parents c9497aad9fc4
children ce0cd7474b64 d49d8b7e168c
files pidgin/plugins/cap/cap.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/cap/cap.c	Sat Jan 27 17:46:52 2007 +0000
+++ b/pidgin/plugins/cap/cap.c	Sun Jan 28 18:19:20 2007 +0000
@@ -136,6 +136,8 @@
 	g_free(stats->prediction);
 	/* g_free(stats->hourly_usage); */
 	/* g_free(stats->daily_usage); */
+	if (stats->timeout_source_id != 0)
+		g_source_remove(stats->timeout_source_id);
 	g_free(stats);
 }
 
@@ -345,6 +347,7 @@
 static void sent_im_msg(GaimAccount *account, const char *receiver, const char *message) {
 	GaimBuddy *buddy;
 	guint interval, words;
+	CapStatistics *stats = NULL;
 
 	buddy = gaim_find_buddy(account, receiver);
 
@@ -354,7 +357,7 @@
 	interval = gaim_prefs_get_int("/plugins/gtk/cap/max_msg_difference") * 1000 * 60;
 	words = word_count(message);
 
-	CapStatistics *stats = get_stats_for(buddy);
+	stats = get_stats_for(buddy);
 
 	insert_word_count(gaim_account_get_username(account), receiver, words);
 	stats->last_message = time(NULL);