diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 569d22501e..f2ae09de0f 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1182,8 +1182,8 @@ sla::DrainHoles SLAPrintObject::transformed_drainhole_points() const { assert(m_model_object != nullptr); auto pts = m_model_object->sla_drain_holes; - auto tr = trafo().cast(); - auto sc = m_model_object->instances.front()->get_scaling_factor().cast(); + const Transform3f tr = trafo().cast(); + const Vec3f sc = m_model_object->instances.front()->get_scaling_factor().cast(); for (sla::DrainHole &hl : pts) { hl.pos = tr * hl.pos; hl.normal = tr * hl.normal - tr.translation(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp index fdc2e0ab0a..c4beb5553c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp @@ -208,8 +208,8 @@ bool GLGizmoBrimEars::unproject_on_mesh2(const Vec2d &mouse_pos, std::pairobject_clipper()->get_position(); const ClippingPlane *clp = m_c->object_clipper()->get_clipping_plane(); bool mouse_on_object = false; - Vec3f position_on_model {}; - Vec3f normal_on_model {}; + Vec3f position_on_model { Vec3f::Zero() }; + Vec3f normal_on_model { Vec3f::Zero() }; double closest_hit_distance = std::numeric_limits::max(); for (auto item : m_mesh_raycaster_map) { diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index a7d2f711bf..4f1b40f8b1 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1049,12 +1049,15 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item) PrintIndicator last_instance_printable = last_instance_node->IsPrintable(); node_parent->GetChildren().Remove(last_instance_node); delete last_instance_node; + // `delete` before `ItemDeleted()` is valid wxWidget pattern +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuse-after-free" ItemDeleted(parent, wxDataViewItem(last_instance_node)); +#pragma GCC diagnostic pop ObjectDataViewModelNode* obj_node = node_parent->GetParent(); obj_node->set_printable_icon(last_instance_printable); obj_node->GetChildren().Remove(node_parent); - delete node_parent; ret_item = wxDataViewItem(obj_node); #ifndef __WXGTK__ @@ -1062,6 +1065,7 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item) obj_node->m_container = false; #endif //__WXGTK__ ItemDeleted(ret_item, wxDataViewItem(node_parent)); + delete node_parent; return ret_item; } @@ -1073,7 +1077,6 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item) { ObjectDataViewModelNode* obj_node = node_parent->GetParent(); obj_node->GetChildren().Remove(node_parent); - delete node_parent; ret_item = wxDataViewItem(obj_node); #ifndef __WXGTK__ @@ -1081,6 +1084,7 @@ wxDataViewItem ObjectDataViewModel::Delete(const wxDataViewItem &item) obj_node->m_container = false; #endif //__WXGTK__ ItemDeleted(ret_item, wxDataViewItem(node_parent)); + delete node_parent; return ret_item; } diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 34063c1ca9..efb8ef87e9 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -3166,7 +3166,7 @@ void Selection::paste_objects_from_clipboard() if (shift_all(0) != 0 || shift_all(1) != 0) { // BBS: if multiple objects are selected, move them as a whole after copy if (i == 0) empty_cell_all = wxGetApp().plater()->canvas3D()->get_nearest_empty_cell({start_point(0), start_point(1)}, {bbox.size()(0)+1,bbox.size()(1)+1}); - auto instance_shift = src_object->instances.front()->get_offset() - src_objects[0]->instances.front()->get_offset(); + const Vec3d instance_shift = src_object->instances.front()->get_offset() - src_objects[0]->instances.front()->get_offset(); displacement = {shift_all.x() + empty_cell_all.x() + instance_shift.x(), shift_all.y() + empty_cell_all.y() + instance_shift.y(), start_offset(2)}; } else { // BBS: if only one object is copied, find an empty cell to put it diff --git a/src/slic3r/GUI/Widgets/LabeledStaticBox.cpp b/src/slic3r/GUI/Widgets/LabeledStaticBox.cpp index 93e4596aa5..2723b3f38a 100644 --- a/src/slic3r/GUI/Widgets/LabeledStaticBox.cpp +++ b/src/slic3r/GUI/Widgets/LabeledStaticBox.cpp @@ -160,7 +160,7 @@ void LabeledStaticBox::DrawBorderAndLabel(wxDC& dc) wxSize wSz = GetSize(); dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.SetPen(wxPen(border_color.colorForStates(state_handler.states()), m_border_width, wxSOLID)); + dc.SetPen(wxPen(border_color.colorForStates(state_handler.states()), m_border_width, wxPENSTYLE_SOLID)); dc.DrawRoundedRectangle( // Border std::max(0, m_pos.x), std::max(0, m_pos.y) + m_label_height * .5, @@ -185,4 +185,4 @@ void LabeledStaticBox::GetBordersForSizer(int* borderTop, int* borderOther) cons #ifdef __WXOSX__ *borderOther = 5; // Make sure macOS uses the same border padding as other platforms #endif -} \ No newline at end of file +}