[evolution] Unref idle loops in finalize.



commit e502c83e159afd3df74c8ff20cf21e56bfb1a242
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri Jul 24 00:18:45 2009 +0530

    Unref idle loops in finalize.

 mail/em-sync-stream.c |   11 +++++++++--
 mail/em-sync-stream.h |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index 7e93b33..8c7d266 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -89,6 +89,7 @@ emss_process_message (struct _write_msg *msg)
 			break;
 	}
 
+	emss->idle_id = 0;
 	e_flag_set (msg->done);
 
 	return FALSE;
@@ -107,8 +108,10 @@ emss_sync_op (EMSyncStream *emss, enum _write_msg_t op,
 	msg.len = len;
 
 	camel_object_ref (emss);
-
-	g_idle_add ((GSourceFunc) emss_process_message, &msg);
+	
+	if (emss->idle_id)
+		g_source_remove (emss->idle_id);
+	emss->idle_id = g_idle_add ((GSourceFunc) emss_process_message, &msg);
 
 	e_flag_wait (msg.done);
 	e_flag_free (msg.done);
@@ -162,6 +165,8 @@ emss_stream_close (CamelStream *stream)
 	if (emss->cancel)
 		return -1;
 
+	emss->idle_id = 0;
+
 	if (mail_in_main_thread ())
 		return EMSS_CLASS (emss)->sync_close (stream);
 	else
@@ -187,6 +192,8 @@ em_sync_stream_finalize (EMSyncStream *emss)
 {
 	if (emss->buffer != NULL)
 		g_string_free (emss->buffer, TRUE);
+	if (emss->idle_id)
+		g_source_remove (emss->idle_id);
 }
 
 CamelType
diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h
index 16cdc27..3d74a02 100644
--- a/mail/em-sync-stream.h
+++ b/mail/em-sync-stream.h
@@ -53,6 +53,7 @@ struct _EMSyncStream {
 	CamelStream parent;
 	GString *buffer;
 	gboolean cancel;
+	guint idle_id;
 };
 
 struct _EMSyncStreamClass {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]