mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
Fix CLI segfault (SIGSEGV) when using --info, --slice, or --export-3mf (#12719)
In CLI mode, PartPlateList is constructed with a NULL plater pointer (OrcaSlicer.cpp:3612). When set_shapes() calls PartPlate::set_shape(), it unconditionally executes render data preparation code that dereferences the null plater through calls like generate_print_polygon() → wxGetApp().plater(), causing a segmentation fault (exit code 139). This adds a null check on m_plater in PartPlate::set_shape() to skip the render-only code block that generates logo triangles, print/exclude polygons, gridlines, icon vertices, and plate name textures. These rendering operations are not needed in CLI mode and this change has no impact on GUI mode where m_plater is always valid.
This commit is contained in:
@@ -3079,53 +3079,42 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, co
|
|||||||
|
|
||||||
calc_bounding_boxes();
|
calc_bounding_boxes();
|
||||||
|
|
||||||
ExPolygon logo_poly;
|
if (m_plater != nullptr) { // render data, skip in CLI mode where m_plater is null
|
||||||
generate_logo_polygon(logo_poly);
|
ExPolygon logo_poly;
|
||||||
m_logo_triangles.reset();
|
generate_logo_polygon(logo_poly);
|
||||||
if (!init_model_from_poly(m_logo_triangles, logo_poly, GROUND_Z + 0.02f))
|
m_logo_triangles.reset();
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create logo triangles\n";
|
if (!init_model_from_poly(m_logo_triangles, logo_poly, GROUND_Z + 0.02f))
|
||||||
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create logo triangles\n";
|
||||||
|
|
||||||
ExPolygon poly;
|
ExPolygon poly;
|
||||||
/*for (const Vec2d& p : m_shape) {
|
generate_print_polygon(poly);
|
||||||
poly.contour.append({ scale_(p(0)), scale_(p(1)) });
|
calc_triangles(poly);
|
||||||
}*/
|
|
||||||
generate_print_polygon(poly);
|
|
||||||
calc_triangles(poly);
|
|
||||||
|
|
||||||
// reset m_wrapping_detection_triangles when change printer
|
// reset m_wrapping_detection_triangles when change printer
|
||||||
m_print_polygon = poly;
|
m_print_polygon = poly;
|
||||||
m_wrapping_detection_triangles.reset();
|
m_wrapping_detection_triangles.reset();
|
||||||
init_raycaster_from_model(m_triangles);
|
init_raycaster_from_model(m_triangles);
|
||||||
|
|
||||||
ExPolygon exclude_poly;
|
ExPolygon exclude_poly;
|
||||||
/*for (const Vec2d& p : m_exclude_area) {
|
generate_exclude_polygon(exclude_poly);
|
||||||
exclude_poly.contour.append({ scale_(p(0)), scale_(p(1)) });
|
calc_exclude_triangles(exclude_poly);
|
||||||
}*/
|
|
||||||
generate_exclude_polygon(exclude_poly);
|
|
||||||
calc_exclude_triangles(exclude_poly);
|
|
||||||
|
|
||||||
const BoundingBox& pp_bbox = poly.contour.bounding_box();
|
const BoundingBox& pp_bbox = poly.contour.bounding_box();
|
||||||
calc_gridlines(poly, pp_bbox);
|
calc_gridlines(poly, pp_bbox);
|
||||||
|
|
||||||
//calc_vertex_for_icons_background(5, m_del_and_background_icon);
|
calc_vertex_for_icons(0, m_del_icon);
|
||||||
//calc_vertex_for_icons(4, m_del_icon);
|
calc_vertex_for_icons(1, m_orient_icon);
|
||||||
calc_vertex_for_icons(0, m_del_icon);
|
calc_vertex_for_icons(2, m_arrange_icon);
|
||||||
calc_vertex_for_icons(1, m_orient_icon);
|
calc_vertex_for_icons(3, m_lock_icon);
|
||||||
calc_vertex_for_icons(2, m_arrange_icon);
|
calc_vertex_for_icons(4, m_plate_settings_icon);
|
||||||
calc_vertex_for_icons(3, m_lock_icon);
|
// ORCA also change bed_icon_count number in calc_vertex_for_icons() after adding or removing icons for circular shaped beds that uses vertical alingment for icons
|
||||||
calc_vertex_for_icons(4, m_plate_settings_icon);
|
bool dual_bbl = false;
|
||||||
// ORCA also change bed_icon_count number in calc_vertex_for_icons() after adding or removing icons for circular shaped beds that uses vertical alingment for icons
|
PresetBundle* preset = wxGetApp().preset_bundle;
|
||||||
bool dual_bbl = false;
|
dual_bbl = (preset->is_bbl_vendor() && preset->get_printer_extruder_count() == 2);
|
||||||
if (m_plater) {
|
calc_vertex_for_icons(dual_bbl ? 5 : 6, m_plate_filament_map_icon);
|
||||||
PresetBundle* preset = wxGetApp().preset_bundle;
|
calc_vertex_for_icons(dual_bbl ? 6 : 5, m_move_front_icon);
|
||||||
dual_bbl = (preset->is_bbl_vendor() && preset->get_printer_extruder_count() == 2);
|
|
||||||
}
|
|
||||||
calc_vertex_for_icons(dual_bbl ? 5 : 6, m_plate_filament_map_icon);
|
|
||||||
calc_vertex_for_icons(dual_bbl ? 6 : 5, m_move_front_icon);
|
|
||||||
|
|
||||||
//calc_vertex_for_number(0, (m_plate_index < 9), m_plate_idx_icon);
|
calc_vertex_for_number(0, false, m_plate_idx_icon);
|
||||||
calc_vertex_for_number(0, false, m_plate_idx_icon);
|
|
||||||
if (m_plater) {
|
|
||||||
// calc vertex for plate name
|
// calc vertex for plate name
|
||||||
generate_plate_name_texture();
|
generate_plate_name_texture();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user