[evolution] Cancel scheduled EMailDisplay reload in _dispose()



commit 0da915da8d8a1d2d584fe905bb4673c25db14fb9
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Jun 27 19:06:03 2012 +0200

    Cancel scheduled EMailDisplay reload in _dispose()

 mail/e-mail-display.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 07dd09c..d265871 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -76,7 +76,7 @@ struct _EMailDisplayPrivate {
 
 	GHashTable *widgets;
 
-	guint reload_scheduled: 1;
+	guint scheduled_reload;
 };
 
 enum {
@@ -339,6 +339,11 @@ mail_display_dispose (GObject *object)
 
 	priv = E_MAIL_DISPLAY_GET_PRIVATE (object);
 
+	if (priv->scheduled_reload > 0) {
+		g_source_remove (priv->scheduled_reload);
+		priv->scheduled_reload = 0;
+	}
+
 	if (priv->part_list) {
 		g_object_unref (priv->part_list);
 		priv->part_list = NULL;
@@ -1467,6 +1472,7 @@ e_mail_display_init (EMailDisplay *display)
 	display->priv->mode = E_MAIL_FORMATTER_MODE_INVALID;
 	e_mail_display_set_mode (display, E_MAIL_FORMATTER_MODE_NORMAL);
 	display->priv->force_image_load = FALSE;
+	display->priv->scheduled_reload = 0;
 
 	webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (display), TRUE);
 
@@ -1723,7 +1729,7 @@ do_reload_display (EMailDisplay *display)
 	web_view = E_WEB_VIEW (display);
 	uri = e_web_view_get_uri (web_view);
 
-	display->priv->reload_scheduled = FALSE;
+	display->priv->scheduled_reload = 0;
 
 	if (!uri || !*uri)
 		return FALSE;
@@ -1765,12 +1771,12 @@ e_mail_display_reload (EMailDisplay *display)
 {
 	g_return_if_fail (E_IS_MAIL_DISPLAY (display));
 
-	if (display->priv->reload_scheduled)
+	if (display->priv->scheduled_reload > 0)
 		return;
 
 	/* Schedule reloading if neccessary */
-	g_idle_add ((GSourceFunc) do_reload_display, display);
-	display->priv->reload_scheduled = TRUE;
+	display->priv->scheduled_reload =
+		g_idle_add ((GSourceFunc) do_reload_display, display);
 }
 
 GtkAction *



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