From 86e6f8bf33cd5bfb75233d3869a586e63c6a79d7 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 3 Dec 2018 16:25:21 +0100 Subject: [PATCH] Fixed integration tests. --- src/libslic3r/Print.cpp | 4 ++++ src/libslic3r/SLAPrint.cpp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 1edb73ed4..a10ec0b98 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -34,6 +34,7 @@ void Print::clear() for (PrintRegion *region : m_regions) delete region; m_regions.clear(); + m_model.clear_objects(); } // Only used by the Perl test cases. @@ -374,6 +375,9 @@ static PrintRegionConfig region_config_from_model_volume(const PrintRegionConfig void Print::add_model_object(ModelObject* model_object, int idx) { tbb::mutex::scoped_lock lock(this->state_mutex()); + // Add a copy of this ModelObject to this Print. + m_model.objects.emplace_back(ModelObject::new_copy(*model_object)); + m_model.objects.back()->set_model(&m_model); // Initialize a new print object and store it at the given position. PrintObject *object = new PrintObject(this, model_object); if (idx != -1) { diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index ff1f7425b..3cb4920a5 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -76,9 +76,10 @@ void SLAPrint::clear() tbb::mutex::scoped_lock lock(this->state_mutex()); // The following call should stop background processing if it is running. this->invalidate_all_steps(); - - for (SLAPrintObject *object : m_objects) delete object; + for (SLAPrintObject *object : m_objects) + delete object; m_objects.clear(); + m_model.clear_objects(); } // Transformation without rotation around Z and without a shift by X and Y.