Merge pull request 'fix(assembly): prevent segfault when all joints are removed' (#310) from fix/assembly-empty-joints-segfault into main
Some checks failed
Build and Test / build (push) Has been cancelled

Reviewed-on: #310
This commit was merged in pull request #310.
This commit is contained in:
2026-02-21 15:47:59 +00:00

View File

@@ -275,8 +275,14 @@ void AssemblyObject::updateSolveStatus()
//+1 because there's a grounded joint to origin //+1 because there's a grounded joint to origin
lastDoF = (1 + numberOfComponents()) * 6; lastDoF = (1 + numberOfComponents()) * 6;
if (!solver_ || lastResult_.placements.empty()) { // Guard against re-entrancy: solve() calls updateSolveStatus(), so if
// placements are legitimately empty (e.g. zero constraints / all parts
// grounded) the recursive solve() would never terminate.
static bool updating = false;
if (!updating && (!solver_ || lastResult_.placements.empty())) {
updating = true;
solve(); solve();
updating = false;
} }
if (!solver_) { if (!solver_) {