[gnome-documents] documents: Clear the thumbnail path if the thumbnail is invalid



commit 1ce43463fa3a69fc3e18c3de3fb4fbf0e0cf42f6
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 24 17:35:12 2013 +0100

    documents: Clear the thumbnail path if the thumbnail is invalid
    
    In some cases, thumbnailing might have failed even if we have a path to
    the thumbnail image. eg., the downloaded thumbnail for some Google
    Drive content might be damaged.
    
    Clear the thumbnail path and remove the invalid file to maintain the
    invariants assumed by the code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720533

 src/documents.js |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index d22407a..dc03e17 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -447,6 +447,8 @@ const DocCommon = new Lang.Class({
                                 } catch (e) {
                                     log('Unable to create pixbuf from ' + thumbFile.get_uri() + ': ' + 
e.toString());
                                     this._failedThumbnailing = true;
+                                    this._thumbPath = null;
+                                    thumbFile.delete_async(GLib.PRIORITY_DEFAULT, null, null);
                                 }
 
                                 // close the underlying stream immediately
@@ -455,6 +457,8 @@ const DocCommon = new Lang.Class({
                 } catch (e) {
                     log('Unable to read file at ' + thumbFile.get_uri() + ': ' + e.toString());
                     this._failedThumbnailing = true;
+                    this._thumbPath = null;
+                    thumbFile.delete_async(GLib.PRIORITY_DEFAULT, null, null);
                 }
             }));
     },


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