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 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-09-21 20:35:03 +02:00
parent 764f3287ff
commit f348dc985f
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 4 additions and 4 deletions

View File

@ -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<Target> forName(string_view name, bool newLines);
string transpileWithTree(const ParseTree& tree) {