Skip to content

Unregister shell modifier volumes from the LOD sharing map before delete - #16

Closed
aceRage wants to merge 1 commit into
mainfrom
cursor/fix-lod-shell-dangling-volume-491f
Closed

aceRage wants to merge 1 commit into
mainfrom
cursor/fix-lod-shell-dangling-volume-491f

Conversation

@aceRage

@aceRage aceRage commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Description

Port of Snapmaker/OrcaSlicer #844 (merged).

GCodeViewer::load_shells() removes modifier volumes with a bare delete, but those volumes were already registered into the global LOD sharing map (g_meshVolumesMap) by load_object_volume(). Deleting them without calling release_volume() leaves dangling GLVolume* entries in the map.

When the same mesh is loaded again (for example switching back to a sliced plate), load_object_volume() can pick up the stale pointer as firstVolume and copy its shared_ptr<GLModel> LOD models, crashing in shared_ptr::operator= (use-after-free).

This change calls GLVolumeCollection::release_volume() before delete, matching the existing paths in clear() and the GLCanvas3D reload (P0-2) on Snapmaker/OrcaSlicer.

Only the modifier-removal loop in src/slic3r/GUI/GCodeViewer.cpp is touched.

Screenshots/Recordings/Graphs

N/A — no UI change.

Tests

Open in Web Open in Cursor 

…ete.

GCodeViewer::load_shells() removed modifiers with a bare delete, leaving
dangling GLVolume* entries in g_meshVolumesMap. Port of Snapmaker/OrcaSlicer Snapmaker#844.

Co-authored-by: aceRage <aceRage@users.noreply.github.com>
@aceRage

aceRage commented Sep 19, 2026

Copy link
Copy Markdown
Owner Author

Closing: the patch calls release_volume() and references g_meshVolumesMap, neither of which exists in this fork's GUI code, so it cannot compile as-is (review 2026-09-19). Reopen against the current LOD code if the dangling-volume case still reproduces.

@aceRage aceRage closed this Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants