[anjal] Cancel handlers well. so that we don't crash.



commit f9f6504a481d03b7967b512f5dcf0a36991f4360
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri Jul 24 00:22:16 2009 +0530

    Cancel handlers well. so that we don't crash.

 src/em-format-mail.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/em-format-mail.c b/src/em-format-mail.c
index 0a5181b..d19b2e7 100644
--- a/src/em-format-mail.c
+++ b/src/em-format-mail.c
@@ -183,9 +183,8 @@ efh_init(GObject *o)
 	efh->state = EM_FORMAT_MAIL_STATE_NONE;
 }
 
-#if 0
 static void
-efh_gtkhtml_destroy(GtkHTML *html, EMFormatMail *efh)
+efh_renderer_destroy(gpointer html, EMFormatMail *efh)
 {
 	if (efh->priv->format_timeout_id != 0) {
 		g_source_remove(efh->priv->format_timeout_id);
@@ -198,12 +197,11 @@ efh_gtkhtml_destroy(GtkHTML *html, EMFormatMail *efh)
 	if (efh->priv->format_id != -1)
 		mail_msg_cancel(efh->priv->format_id);
 
-	if (efh->html) {
-		g_object_unref(efh->html);
-		efh->html = NULL;
-	}
+//	if (efh->html) {
+//		g_object_unref(efh->html);
+//		efh->html = NULL;
+//	}
 }
-#endif
 
 static struct _EMFormatMailCache *
 efh_insert_cache(EMFormatMail *efh, const gchar *partid)
@@ -226,13 +224,11 @@ efh_finalise(GObject *o)
 	/* FIXME: check for leaked stuff */
 
 	em_format_mail_clear_pobject(efh);
-
-	//efh_gtkhtml_destroy(efh->html, efh);
+	efh_renderer_destroy(NULL, efh);
 
 	g_hash_table_destroy(efh->priv->text_inline_parts);
 
 	g_free(efh->priv);
-
 	((GObjectClass *)efh_parent)->finalize(o);
 }
 
@@ -430,6 +426,8 @@ em_format_mail_remove_pobject(EMFormatMail *emf, EMFormatMailPObject *pobject)
 	if (pobject->free)
 		pobject->free(pobject);
 	g_free(pobject->classid);
+	if (pobject->stream)
+		camel_object_unref(pobject->stream);
 	g_free(pobject);
 }
 
@@ -2121,6 +2119,7 @@ static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart
 		efh_format_headers(efh, lstream, (CamelMedium *)part);
 		camel_stream_write_string(lstream, "</body></html>");
 		camel_stream_close (lstream);
+		camel_object_unref(lstream);
 		efh->header_stream = NULL;
 
 	}



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