From 3837863663156ec15346f36614b3153ffbc74ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Tue, 4 Oct 2022 14:01:16 +0200 Subject: [PATCH] Constant scalars: Don't flush double Paths were created in duplicate --- src/Mesh.cpp | 28 ++++++++++++++++------------ src/Record.cpp | 28 +++++++++++++++++----------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 6f9b891635..d570840e98 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -243,25 +243,29 @@ void Mesh::flush_impl( pCreate.path = name; IOHandler()->enqueue(IOTask(this, pCreate)); for (auto &comp : *this) + { comp.second.parent() = &this->writable(); + comp.second.flush(comp.first, flushParams); + } } } - - if (scalar()) + else { - for (auto &comp : *this) + if (scalar()) { - comp.second.flush(name, flushParams); - writable().abstractFilePosition = - comp.second.writable().abstractFilePosition; + for (auto &comp : *this) + { + comp.second.flush(name, flushParams); + writable().abstractFilePosition = + comp.second.writable().abstractFilePosition; + } + } + else + { + for (auto &comp : *this) + comp.second.flush(comp.first, flushParams); } } - else - { - for (auto &comp : *this) - comp.second.flush(comp.first, flushParams); - } - flushAttributes(flushParams); break; } diff --git a/src/Record.cpp b/src/Record.cpp index bbd74ed0f5..717d709072 100644 --- a/src/Record.cpp +++ b/src/Record.cpp @@ -73,23 +73,29 @@ void Record::flush_impl( pCreate.path = name; IOHandler()->enqueue(IOTask(this, pCreate)); for (auto &comp : *this) + { comp.second.parent() = getWritable(this); + comp.second.flush(comp.first, flushParams); + } } } - - if (scalar()) + else { - for (auto &comp : *this) + + if (scalar()) { - comp.second.flush(name, flushParams); - writable().abstractFilePosition = - comp.second.writable().abstractFilePosition; + for (auto &comp : *this) + { + comp.second.flush(name, flushParams); + writable().abstractFilePosition = + comp.second.writable().abstractFilePosition; + } + } + else + { + for (auto &comp : *this) + comp.second.flush(comp.first, flushParams); } - } - else - { - for (auto &comp : *this) - comp.second.flush(comp.first, flushParams); } flushAttributes(flushParams);