mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
Fixing thread-safe StaticConfig creations #6477
fix un-threadsafe code for creating config enum hashtable. #6475
This commit is contained in:
parent
36bd23efdd
commit
a7368b9deb
3 changed files with 187 additions and 202 deletions
|
@ -1390,22 +1390,7 @@ public:
|
|||
}
|
||||
|
||||
// Map from an enum name to an enum integer value.
|
||||
static const t_config_enum_names& get_enum_names()
|
||||
{
|
||||
static t_config_enum_names names;
|
||||
if (names.empty()) {
|
||||
// Initialize the map.
|
||||
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
|
||||
int cnt = 0;
|
||||
for (const auto& kvp : enum_keys_map)
|
||||
cnt = std::max(cnt, kvp.second);
|
||||
cnt += 1;
|
||||
names.assign(cnt, "");
|
||||
for (const auto& kvp : enum_keys_map)
|
||||
names[kvp.second] = kvp.first;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
static const t_config_enum_names& get_enum_names();
|
||||
// Map from an enum name to an enum integer value.
|
||||
static const t_config_enum_values& get_enum_values();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue