From f348dc985f3d066721118149adf11ad94a043b77 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 21 Sep 2022 20:35:03 +0200 Subject: [PATCH] Target.hpp: Don't return a reference to a static thread-local map in the Target::getTaskMapInstance function It only worked properly with the "--parallel" flag Signed-off-by: Username404 --- src/headers/transpiler/Target.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index 859aa19..96dcd6c 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -124,10 +124,10 @@ protected: string separator; static constexpr const char* indentation = " "; public: - const unordered_task_map& getTaskMapInstance() { - static thread_local unordered_task_map staticMap = getTaskMap(); + unordered_task_map getTaskMapInstance() { + unordered_task_map fullMap = getTaskMap(); // Default / Shared tasks: - staticMap.merge(unordered_task_map({ + fullMap.merge(unordered_task_map({ make_task(ParseTree, transpileTree(parseComponent);), make_task(StandardComponents::Reference, output << parseComponent.name;), make_task(StandardComponents::Call, @@ -139,7 +139,7 @@ public: ), make_task(StandardComponents::types::Integer, output << setprecision(parseComponent.precision) << fixed << parseComponent.value;) })); - return staticMap; + return fullMap; }; static unique_ptr forName(string_view name, bool newLines); string transpileWithTree(const ParseTree& tree) {