From 8db263f4c445437d027dc005178629ce2ebe8f3c Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Wed, 14 Jan 2015 15:29:40 -0800 Subject: [PATCH] Fix gallery append bugs introduced by deferred opening of gallery files --- openbr/openbr_plugin.cpp | 9 +++++++-- openbr/plugins/gallery.cpp | 5 ++++- openbr/plugins/misc.cpp | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 1583b66..9d0b169 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -1307,8 +1307,13 @@ void Gallery::init() { if (file.exists() && file.contains("append")) { - TemplateList data = this->read(); - this->writeBlock(data); + File rFile = file; + rFile.remove("append"); + Gallery *reader = Gallery::make(rFile); + TemplateList data = reader->read(); + delete reader; + + writeBlock(data); } } diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index ef09714..5036aec 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -766,8 +766,11 @@ class memGallery : public Gallery BR_REGISTER(Gallery, memGallery) -FileList FileList::fromGallery(const File &file, bool cache) +FileList FileList::fromGallery(const File &rFile, bool cache) { + File file = rFile; + file.remove("append"); + File targetMeta = file; targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem"; diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index a9776ca..71d94b2 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -981,7 +981,10 @@ class FileExclusionTransform : public UntrainableMetaTransform { if (exclusionGallery.isEmpty()) return; - FileList temp = FileList::fromGallery(exclusionGallery); + File rFile(exclusionGallery); + rFile.remove("append"); + + FileList temp = FileList::fromGallery(rFile); excluded = QSet::fromList(temp.names()); } }; -- libgit2 0.21.4