Commit 8db263f4c445437d027dc005178629ce2ebe8f3c

Authored by Charles Otto
1 parent 50ec8418

Fix gallery append bugs introduced by deferred opening of gallery files

openbr/openbr_plugin.cpp
@@ -1307,8 +1307,13 @@ void Gallery::init() @@ -1307,8 +1307,13 @@ void Gallery::init()
1307 { 1307 {
1308 if (file.exists() && file.contains("append")) 1308 if (file.exists() && file.contains("append"))
1309 { 1309 {
1310 - TemplateList data = this->read();  
1311 - this->writeBlock(data); 1310 + File rFile = file;
  1311 + rFile.remove("append");
  1312 + Gallery *reader = Gallery::make(rFile);
  1313 + TemplateList data = reader->read();
  1314 + delete reader;
  1315 +
  1316 + writeBlock(data);
1312 } 1317 }
1313 } 1318 }
1314 1319
openbr/plugins/gallery.cpp
@@ -766,8 +766,11 @@ class memGallery : public Gallery @@ -766,8 +766,11 @@ class memGallery : public Gallery
766 766
767 BR_REGISTER(Gallery, memGallery) 767 BR_REGISTER(Gallery, memGallery)
768 768
769 -FileList FileList::fromGallery(const File &file, bool cache) 769 +FileList FileList::fromGallery(const File &rFile, bool cache)
770 { 770 {
  771 + File file = rFile;
  772 + file.remove("append");
  773 +
771 File targetMeta = file; 774 File targetMeta = file;
772 targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem"; 775 targetMeta.name = targetMeta.path() + targetMeta.baseName() + "_meta" + targetMeta.hash() + ".mem";
773 776
openbr/plugins/misc.cpp
@@ -981,7 +981,10 @@ class FileExclusionTransform : public UntrainableMetaTransform @@ -981,7 +981,10 @@ class FileExclusionTransform : public UntrainableMetaTransform
981 { 981 {
982 if (exclusionGallery.isEmpty()) 982 if (exclusionGallery.isEmpty())
983 return; 983 return;
984 - FileList temp = FileList::fromGallery(exclusionGallery); 984 + File rFile(exclusionGallery);
  985 + rFile.remove("append");
  986 +
  987 + FileList temp = FileList::fromGallery(rFile);
985 excluded = QSet<QString>::fromList(temp.names()); 988 excluded = QSet<QString>::fromList(temp.names());
986 } 989 }
987 }; 990 };