[shotwell] Relax assertion in Photo file monitor



commit 1886512e64c2a46313585533a51ca34a857eb861
Author: Jens Georg <mail jensge org>
Date:   Fri Apr 29 20:59:23 2016 +0200

    Relax assertion in Photo file monitor
    
    If the file is newly created, due to the way exiv2 does the metadata
    writing (remove => rename due to windows limitations) and we do not ask
    GLib for the MOVE event, we receive a DELETE event for the temp file
    that exiv2 creats.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759403

 src/Photo.vala |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/Photo.vala b/src/Photo.vala
index 2f2b7a5..bc0b7e5 100644
--- a/src/Photo.vala
+++ b/src/Photo.vala
@@ -4079,7 +4079,14 @@ public abstract class Photo : PhotoSource, Dateable {
     private void on_editable_file_changed(File file, File? other_file, FileMonitorEvent event) {
         // This has some expense, but this assertion is important for a lot of sanity reasons.
         lock (readers) {
-            assert(readers.editable != null && file.equal(readers.editable.get_file()));
+            assert(readers.editable != null);
+
+            if (!file.equal(readers.editable.get_file())) {
+                // Ignore. When the export file is created, we receive a
+                // DELETE event for renaming temporary file created by exiv2 when
+                // writing meta-data.
+                return;
+            }
         }
         
         debug("EDITABLE %s: %s", event.to_string(), file.get_path());


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