mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 10:51:22 +00:00
The constraint list follows you into a live sketch
The rows, their ✗ buttons and the click-to-highlight were all built against m_doc.features[m_constrain_feat].entity_constraints — a COMMITTED feature. A live sketch has no committed feature, so the card was hidden for the whole session and the list it would have shown was empty by construction. Every constraint applied while drawing was nameless: the badge said one existed, nothing said which. rebuild_constraint_list now picks its source by scope. live_constraint_scope() is the same discriminator apply_constraint already used to route to apply_live_constraint — both Constrain modes set m_active, so is_sketching() alone would claim the live scope while the committed manager is open. delete_constraint and highlight_constraint_entities branch on it too, and the card shows in Sketch mode as well as Constrain. Keeping the rows in step needed a signal that did not exist: on_solve_state fires on every frame of a drag, so rebuilding from it would rebuild the list continuously. The tool now fires on_constraints_changed only when the constraint SET changes — one added by try_add_constraints, one removed by remove_constraint (the indexed form the badge click and the ✗ row now share). The rebuild is deferred through CallAfter. One of its callers is the ✗ button's own click handler, and rebuild_constraint_list destroys those buttons: deleting the window whose handler is still on the stack is a use-after-free. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FbJKJAJxxkhDTs9XdZzKA
This commit is contained in:
co-authored by
Claude Opus 5
parent
b250a2b858
commit
9858080aa0
@@ -240,6 +240,11 @@ private:
|
||||
// entity-constraints with per-row select (highlight the referenced entities in
|
||||
// the viewport) and delete (drop the constraint + re-solve). Shown in Constrain
|
||||
// mode only; operates on m_doc.features[m_constrain_feat].entity_constraints.
|
||||
// True when the constraint UI must address the LIVE sketch session rather than a committed
|
||||
// feature. Same discriminator apply_constraint uses to choose apply_live_constraint: both
|
||||
// Constrain modes set m_active too, so is_sketching() alone would claim the live scope while
|
||||
// the committed manager is open.
|
||||
bool live_constraint_scope() const;
|
||||
void rebuild_constraint_list(); // refill m_constraint_rows
|
||||
void delete_constraint(int idx); // erase + re-solve + refresh
|
||||
void highlight_constraint_entities(int idx); // push referenced entities to viewport
|
||||
|
||||
Reference in New Issue
Block a user