From 74799ade143e2f85e4a306ce6303e6e47fe5707a Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 21 Feb 2020 10:02:41 +0100 Subject: [PATCH 1/5] Fixed two cases of crashes on application close Both related to ObjectList - it was attempting to call plater after it was destroyed Approved by @YuSanka --- src/slic3r/GUI/GUI_ObjectList.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a5566de29..f5f554830 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -77,7 +77,9 @@ static int extruders_count() static void take_snapshot(const wxString& snapshot_name) { - wxGetApp().plater()->take_snapshot(snapshot_name); + Plater* plater = wxGetApp().plater(); + if (plater) + plater->take_snapshot(snapshot_name); } ObjectList::ObjectList(wxWindow* parent) : @@ -3931,7 +3933,9 @@ void ObjectList::OnEditingDone(wxDataViewEvent &event) m_last_selected_column = -1; #endif //__WXMSW__ - wxGetApp().plater()->set_current_canvas_as_dirty(); + Plater* plater = wxGetApp().plater(); + if (plater) + plater->set_current_canvas_as_dirty(); } void ObjectList::show_multi_selection_menu() From 57c0a313a45ca6ec31aa2da605fdd83011e46981 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 21 Feb 2020 10:05:03 +0100 Subject: [PATCH 2/5] Fixed typo in an error message --- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 53c3ec5ea..363a7d8e1 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -110,12 +110,12 @@ void BackgroundSlicingProcess::process_fff() } else if (with_check && copy_ret_val == -4) { - std::string err_msg = "Copying of the temporary G-code has finnished but the original code at "+ m_temp_output_path +" couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; + std::string err_msg = "Copying of the temporary G-code has finished but the original code at "+ m_temp_output_path +" couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; throw std::runtime_error(_utf8(L(err_msg))); } else if (with_check && copy_ret_val == -5) { - std::string err_msg = "Copying of the temporary G-code has finnished but the exported code couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; + std::string err_msg = "Copying of the temporary G-code has finished but the exported code couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; throw std::runtime_error(_utf8(L(err_msg))); } else if (copy_ret_val == -3) From 8be3d074fd5bc0449c1c968f6e63c294008973bb Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 20 Feb 2020 13:23:25 +0100 Subject: [PATCH 3/5] Fix of wipe into object The bug was introduced in 15eedef. lower_bound_by_predicate implementation returns first item that does not satisfy the predicate, not last item that does. --- src/libslic3r/Print.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 4f9f9ad1e..a23922426 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -150,15 +150,15 @@ public: Layer* get_layer(int idx) { return m_layers[idx]; } // Get a layer exactly at print_z. const Layer* get_layer_at_printz(coordf_t print_z) const { - auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [print_z](const Layer *layer) { return layer->print_z < print_z; }); + auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [print_z](const Layer *layer) { return layer->print_z < print_z; }); return (it == m_layers.end() || (*it)->print_z != print_z) ? nullptr : *it; } Layer* get_layer_at_printz(coordf_t print_z) { return const_cast(std::as_const(*this).get_layer_at_printz(print_z)); } // Get a layer approximately at print_z. const Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon) const { - coordf_t limit = print_z + epsilon; - auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [limit](const Layer *layer) { return layer->print_z < limit; }); - return (it == m_layers.end() || (*it)->print_z < print_z - epsilon) ? nullptr : *it; + coordf_t limit = print_z - epsilon; + auto it = Slic3r::lower_bound_by_predicate(m_layers.begin(), m_layers.end(), [limit](const Layer *layer) { return layer->print_z < limit; }); + return (it == m_layers.end() || (*it)->print_z > print_z + epsilon) ? nullptr : *it; } Layer* get_layer_at_printz(coordf_t print_z, coordf_t epsilon) { return const_cast(std::as_const(*this).get_layer_at_printz(print_z, epsilon)); } From 004b23e362e38154197401148224565f1ad5f305 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 21 Feb 2020 11:03:03 +0100 Subject: [PATCH 4/5] Fix of Bug: Changing print settings resets filament settings #3675 When switching a Print profile, the modifications of an active Filament profile were incorrecly dropped even if the active Filament profile was compatible with the newly selected Print profile. --- src/slic3r/GUI/Tab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e0cfe5be6..541be423d 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2795,7 +2795,7 @@ void Tab::select_preset(std::string preset_name, bool delete_current) if (! canceled) { // The preset will be switched to a different, compatible preset, or the '-- default --'. m_dependent_tabs.emplace_back((printer_technology == ptFFF) ? Preset::Type::TYPE_FILAMENT : Preset::Type::TYPE_SLA_MATERIAL); - if (old_preset_dirty) + if (old_preset_dirty && ! new_preset_compatible) dependent.discard_current_changes(); } } else if (printer_tab) { From 427cf32849f13ec32162744193751262fcc8983d Mon Sep 17 00:00:00 2001 From: David Kocik Date: Fri, 21 Feb 2020 11:17:48 +0100 Subject: [PATCH 5/5] refactoring of errors at copying g-code to target destination --- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 41 +++++++++------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 363a7d8e1..27aa6eaa6 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -103,30 +103,25 @@ void BackgroundSlicingProcess::process_fff() GUI::RemovableDriveManager::get_instance().update(); bool with_check = GUI::RemovableDriveManager::get_instance().is_path_on_removable_drive(export_path); int copy_ret_val = copy_file(m_temp_output_path, export_path, with_check); - if (with_check && copy_ret_val == -2) - { - std::string err_msg = "Copying of the temporary G-code to the output G-code failed. There might be problem with target device, please try exporting again or using different device. The corrupted output G-code is at " + export_path + ".tmp."; - throw std::runtime_error(_utf8(L(err_msg))); - } - else if (with_check && copy_ret_val == -4) - { - std::string err_msg = "Copying of the temporary G-code has finished but the original code at "+ m_temp_output_path +" couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; - throw std::runtime_error(_utf8(L(err_msg))); - } - else if (with_check && copy_ret_val == -5) - { - std::string err_msg = "Copying of the temporary G-code has finished but the exported code couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp."; - throw std::runtime_error(_utf8(L(err_msg))); - } - else if (copy_ret_val == -3) - { - std::string err_msg = "Renaming of the G-code after copying to the selected destination folder has failed. Current path is " + export_path + ".tmp. Please try exporting again."; - throw std::runtime_error(_utf8(L(err_msg))); - } - else if ( copy_ret_val != 0) - { - throw std::runtime_error(_utf8(L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?"))); + switch (copy_ret_val){ + case 0: break; // no error + case -2: + throw std::runtime_error((boost::format(_utf8(L("Copying of the temporary G-code to the output G-code failed. There might be problem with target device, please try exporting again or using different device. The corrupted output G-code is at %1%.tmp."))) % export_path).str()); + break; + case -3: + throw std::runtime_error((boost::format(_utf8(L("Renaming of the G-code after copying to the selected destination folder has failed. Current path is %1%.tmp. Please try exporting again."))) % export_path).str()); + break; + case -4: + throw std::runtime_error((boost::format(_utf8(L("Copying of the temporary G-code has finished but the original code at %1% couldn't be opened during copy check. The output G-code is at %2%.tmp."))) % m_temp_output_path % export_path).str()); + break; + case -5: + throw std::runtime_error((boost::format(_utf8(L("Copying of the temporary G-code has finished but the exported code couldn't be opened during copy check. The output G-code is at %1%.tmp."))) % export_path).str()); + break; + default: + throw std::runtime_error(_utf8(L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?"))); + break; } + m_print->set_status(95, _utf8(L("Running post-processing scripts"))); run_post_process_scripts(export_path, m_fff_print->config()); m_print->set_status(100, (boost::format(_utf8(L("G-code file exported to %1%"))) % export_path).str());