Fix CLI segfault (SIGSEGV) when using --info, --slice, or --export-3mf #370

Closed
opened 2026-04-05 16:20:22 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @niccolodevries on 3/10/2026

Summary

The OrcaSlicer CLI crashes with a segmentation fault (exit code 139) on every command that loads a model (--info, --slice, --export-3mf). This makes the CLI completely unusable.

Root cause: 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().

Fix: Add a if (m_plater != nullptr) guard around the render-only code block in PartPlate::set_shape(), skipping:

  • Logo polygon and triangle generation
  • Print/exclude polygon generation and triangle calculation
  • Gridline calculation
  • Icon and plate name vertex computation

This has zero impact on GUI mode where m_plater is always a valid pointer. Only CLI mode (where m_plater is NULL) is affected.

Steps to reproduce

# Any of these crash with exit code 139 (SIGSEGV):
OrcaSlicer --info model.stl
OrcaSlicer --slice 0 model.stl
OrcaSlicer --export-3mf output.3mf model.stl

After fix

$ OrcaSlicer --info 3DBenchy.stl
[3DBenchy.stl]
size_x = 60.000999
size_y = 31.004000
size_z = 48.000000
...
number_of_facets = 225154
manifold = yes
volume = 15550.382812
*Originally created by @niccolodevries on 3/10/2026* ## Summary The OrcaSlicer CLI crashes with a segmentation fault (exit code 139) on **every** command that loads a model (`--info`, `--slice`, `--export-3mf`). This makes the CLI completely unusable. **Root cause:** 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()`. **Fix:** Add a `if (m_plater != nullptr)` guard around the render-only code block in `PartPlate::set_shape()`, skipping: - Logo polygon and triangle generation - Print/exclude polygon generation and triangle calculation - Gridline calculation - Icon and plate name vertex computation This has **zero impact on GUI mode** where `m_plater` is always a valid pointer. Only CLI mode (where `m_plater` is `NULL`) is affected. ## Steps to reproduce ```bash # Any of these crash with exit code 139 (SIGSEGV): OrcaSlicer --info model.stl OrcaSlicer --slice 0 model.stl OrcaSlicer --export-3mf output.3mf model.stl ``` ## After fix ``` $ OrcaSlicer --info 3DBenchy.stl [3DBenchy.stl] size_x = 60.000999 size_y = 31.004000 size_z = 48.000000 ... number_of_facets = 225154 manifold = yes volume = 15550.382812 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#370