[evolution/gnome-3-28] [EMailDisplay] Do not call reload when nothing is loaded



commit a87218979fe79b0012f21705d7ef83a47eba009a
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 9 16:11:49 2018 +0200

    [EMailDisplay] Do not call reload when nothing is loaded
    
    It can happen that the EMailDisplay's reload, due to property changes,
    is scheduled for idle during the EMailBrowser construction and that
    idle callback is called when WebKitGTK+ doesn't have loaded expected
    URI in it, only "about:blank". Calling reload in such state can prevent
    the real (and possibly ongoing) request to be cancelled, which results
    in an empty message preview. Avoiding schedule of such false reload
    helps to prevent this situation.
    
    This had been reported downstream at:
    https://bugzilla.redhat.com/show_bug.cgi?id=1560312

 src/mail/e-mail-display.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/mail/e-mail-display.c b/src/mail/e-mail-display.c
index b7d00a1..65506ed 100644
--- a/src/mail/e-mail-display.c
+++ b/src/mail/e-mail-display.c
@@ -2568,7 +2568,7 @@ do_reload_display (EMailDisplay *display)
 
        display->priv->scheduled_reload = 0;
 
-       if (uri == NULL || *uri == '\0')
+       if (!uri || !*uri || g_ascii_strcasecmp (uri, "about:blank") == 0)
                return FALSE;
 
        if (strstr (uri, "?") == NULL) {
@@ -2623,9 +2623,14 @@ do_reload_display (EMailDisplay *display)
 void
 e_mail_display_reload (EMailDisplay *display)
 {
+       const gchar *uri;
+
        g_return_if_fail (E_IS_MAIL_DISPLAY (display));
 
-       if (display->priv->scheduled_reload > 0)
+       uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (display));
+
+       if (!uri || !*uri || g_ascii_strcasecmp (uri, "about:blank") == 0 ||
+           display->priv->scheduled_reload > 0)
                return;
 
        /* Schedule reloading if neccessary.


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