Skip to content

Commit

Permalink
fill_aligned_z: fix uninitialized atomic_int64_t (#4279)
Browse files Browse the repository at this point in the history
The behavior of atomic_int64_t's default constructor will leave it to an
uninitialized state (accessing it will be undefined behavior).

Use 0 to explicitly initialize it because it will be soon compared and
exchanged.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
  • Loading branch information
Icenowy authored and supermerill committed May 28, 2024
1 parent cb34b03 commit a61b977
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ namespace Slic3r {
void PrintObject::_compute_max_sparse_spacing()
{
m_max_sparse_spacing = 0;
std::atomic_int64_t max_sparse_spacing;
std::atomic_int64_t max_sparse_spacing(0);
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()),
[this, &max_sparse_spacing](const tbb::blocked_range<size_t>& range) {
Expand Down

0 comments on commit a61b977

Please sign in to comment.