Skip to content

Commit

Permalink
[BUGFIX] Prevent crash in small area infill comp with gcode comments (#…
Browse files Browse the repository at this point in the history
…3786)

Enabling the option "Verbose G-Code" would trigger a crash in the Small Area Infill flow compensation due to concurrent access/modification of the gcode comment.
  • Loading branch information
mjonuschat authored Jan 22, 2024
1 parent 273b368 commit 7aee846
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5207,6 +5207,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
// Attention: G2 and G3 is not supported in spiral_mode mode
if (!m_config.enable_arc_fitting || path.polyline.fitting_result.empty() || m_config.spiral_mode) {
for (const Line& line : path.polyline.lines()) {
std::string tempDescription = description;
const double line_length = line.length() * SCALING_FACTOR;
path_length += line_length;
auto dE = e_per_mm * line_length;
Expand All @@ -5215,13 +5216,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());

if (m_config.gcode_comments && oldE > 0 && oldE != dE) {
description += Slic3r::format(" | Old Flow Value: %0.5f Length: %0.5f",oldE, line_length);
tempDescription += Slic3r::format(" | Old Flow Value: %0.5f Length: %0.5f",oldE, line_length);
}
}
gcode += m_writer.extrude_to_xy(
this->point_to_gcode(line.b),
dE,
GCodeWriter::full_gcode_comment ? description : "", path.is_force_no_extrusion());
GCodeWriter::full_gcode_comment ? tempDescription : "", path.is_force_no_extrusion());
}
} else {
// BBS: start to generate gcode from arc fitting data which includes line and arc
Expand Down

0 comments on commit 7aee846

Please sign in to comment.