Skip to content

global_scene_solver: fix add_scenes() stale scene cleanup - #379

Merged
bl4ckb0ne merged 1 commit into
collabora:masterfrom
damaestro:fix-gss-scene-cleanup
Oct 19, 2026
Merged

bl4ckb0ne merged 1 commit into
collabora:masterfrom
damaestro:fix-gss-scene-cleanup

Conversation

@damaestro

Copy link
Copy Markdown
Contributor

The cleanup added in f23d298 compacted scenes by copying only the .so pointer, pairing objects with another slot's pose/measurements, and reset scenes_cnt (a ring counter) on every call. This made the global solve diverge and broke the lh2_test_cal.pcap.gz_pcap and haagh-tracking2.rec.gz tests.

Compact by swapping whole entries, scan only the filled slots, and touch scenes_cnt only when a scene was removed.

Comment thread src/driver_global_scene_solver.c
Comment thread src/driver_global_scene_solver.c Outdated
The cleanup added in f23d298 compacted scenes by copying only the .so
pointer, pairing objects with another slot's pose/measurements, and reset
scenes_cnt (a ring counter) on every call. This made the global solve
diverge and broke the lh2_test_cal.pcap.gz_pcap and haagh-tracking2.rec.gz
tests.

Compact by swapping whole entries, scan only the filled slots (clamping
the unbounded ring counter), and touch scenes_cnt only when a scene was
removed. Factor the liveness check into scene_object_alive(), and use the
clamped count in run_optimization() so the auto-floor and SPHERE loops
cannot read past scenes[] once the ring has wrapped.

Assisted-by: Claude Code:claude-sonnet-5-5
@damaestro
damaestro force-pushed the fix-gss-scene-cleanup branch from add7631 to 85b1b3c Compare October 18, 2026 16:05

@bl4ckb0ne bl4ckb0ne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bl4ckb0ne
bl4ckb0ne merged commit 44e9a29 into collabora:master Oct 19, 2026
2 of 4 checks passed
@damaestro
damaestro deleted the fix-gss-scene-cleanup branch October 20, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants