Browse Source

fill_aligned_z: fix uninitialized atomic_int64_t (#4279)

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>
Icenowy Zheng 9 months ago
parent
commit
1d7a679b09
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/libslic3r/PrintObject.cpp

+ 1 - 1
src/libslic3r/PrintObject.cpp

@@ -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) {