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



commit 0a11955c3e7ccf4ac813980817e08de4e95ba5b9
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 edd5396..96f0e3a 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -450,6 +450,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
@@ -458,6 +460,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]