Skip to content

fix: exit number rain loop when scene completes#89

Merged
patrickschaper merged 1 commit into
developmentfrom
fix/infinite-loop-number-rain
Jun 8, 2026
Merged

fix: exit number rain loop when scene completes#89
patrickschaper merged 1 commit into
developmentfrom
fix/infinite-loop-number-rain

Conversation

@patrickschaper

Copy link
Copy Markdown
Owner

Problem

The stepNumberRain() function had an infinite loop that froze all screens during the number-to-rain scene transition in multi-display engine mode.

Root cause: When numberSceneDoneRequested was set to true by blackoutColumns(), the while condition activeScene == .numberIntro remained true forever because:

  • activeScene never changed (stays .numberIntro in engine mode; only changes on next frame)
  • blackoutColumns() returned immediately on subsequent iterations due to guard check
  • The loop spun infinitely within a single advance() call, freezing the entire thread

Solution

Added !numberSceneDoneRequested check to both:

  1. The while loop condition in stepNumberRain()
  2. The guard statement in stepNumberRain()

This ensures the loop exits immediately when the scene signals completion, allowing the phase-advance barrier to resolve and transition to the rain scene.

Testing

  • All 31 existing tests pass
  • Manual testing on multi-display setup needed to verify sync behavior

Changes

  • NativeMatrixRenderer.swift: Added done-flag checks to stepNumberRain()

- Add !numberSceneDoneRequested check to while condition in stepNumberRain()
- Add !numberSceneDoneRequested check to guard in stepNumberRain()
- Prevents infinite loop when scene signals completion via flag
- Allows phase-advance barrier to resolve and transition to rain scene
@patrickschaper patrickschaper enabled auto-merge (squash) June 8, 2026 15:14
@patrickschaper patrickschaper merged commit 1dfc3b2 into development Jun 8, 2026
4 checks passed
@patrickschaper patrickschaper deleted the fix/infinite-loop-number-rain branch June 8, 2026 15:14
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.

1 participant