[evolution/gnome-3-16] EHTTPRequest - GFileInfo not valid when machine is under heavy load



commit 49028f118d12786180304651878ea4804a96245e
Author: Tomas Popela <tpopela redhat com>
Date:   Wed May 6 14:42:44 2015 +0200

    EHTTPRequest - GFileInfo not valid when machine is under heavy load
    
    When the machine is under heavy load and I'm moving between messages with
    inline images (that are already downloaded and are in the cache) I get warnings
    that GFileInfo object is not valid. I managed to get these warnings when the task
    was already cancelled (I already moved to another message) but for the active task
    as well. So try to access the GFileInfo object just when we know that it is valid.

 mail/e-http-request.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/mail/e-http-request.c b/mail/e-http-request.c
index 5453c54..7be9f55 100644
--- a/mail/e-http-request.c
+++ b/mail/e-http-request.c
@@ -278,16 +278,18 @@ handle_http_request (GSimpleAsyncResult *res,
                                file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                0, cancellable, NULL);
 
-                       priv->content_type = g_strdup (
-                               g_file_info_get_content_type (info));
-
-                       d (
-                               printf ("'%s' found in cache (%d bytes, %s)\n",
-                               uri, priv->content_length,
-                               priv->content_type));
+                       if (info) {
+                               priv->content_type = g_strdup (
+                                       g_file_info_get_content_type (info));
+
+                               d (
+                                       printf ("'%s' found in cache (%d bytes, %s)\n",
+                                       uri, priv->content_length,
+                                       priv->content_type));
+                       }
 
-                       g_object_unref (info);
-                       g_object_unref (file);
+                       g_clear_object (&info);
+                       g_clear_object (&file);
                        g_free (path);
 
                        /* Set result and quit the thread */


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