Rework of Add random function for gcode macros. #5219 after merge:

The thread local storage variables for the random number generator
were replaced by an external context variable.
Thread local storage is a scarce resource.
This commit is contained in:
Vojtech Bubnik 2020-12-09 09:19:46 +01:00
parent 1e190affcf
commit 7353d8c6e9
4 changed files with 48 additions and 23 deletions

View file

@ -1340,7 +1340,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
std::string GCode::placeholder_parser_process(const std::string &name, const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override)
{
try {
return m_placeholder_parser.process(templ, current_extruder_id, config_override);
return m_placeholder_parser.process(templ, current_extruder_id, config_override, &m_placeholder_parser_context);
} catch (std::runtime_error &err) {
// Collect the names of failed template substitutions for error reporting.
auto it = m_placeholder_parser_failed_templates.find(name);