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 <[email protected]>
  • Loading branch information
Icenowy authored May 27, 2024
1 parent c849901 commit 1d7a679
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 @@ -551,7 +551,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 1d7a679

Please sign in to comment.