mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-15 15:03:49 +00:00
NfpPlacer stores std::reference_wrapper to the items it packs and re-reads them from finalAlign() in its destructor (via clearItems()). Two placer tests declared the placer before the items in the same scope, so the items were destroyed first and the destructor dereferenced dangling references. On macOS this is a deterministic SIGSEGV: libmalloc poisons the freed block on free, so the item's point vector reads back as ~null (deref at 0x8). On Linux/glibc the freed bytes usually survive, which is why it slipped through upstream CI (introduced by #14267). Declare the items before the placer so they outlive it, matching the pattern the sibling 'packs many items' and 'obstacle' tests already use. Test-only; the library lifetime contract (items must outlive the placer) is unchanged and honored in production via _Nester in Arrange.cpp.