Skip to content

fix: coalesce window activation events through classic pending slots - #599

Open
benletchford wants to merge 1 commit into
masterfrom
dev/civilization-ii-activate-events
Open

fix: coalesce window activation events through classic pending slots#599
benletchford wants to merge 1 commit into
masterfrom
dev/civilization-ii-activate-events

Conversation

@benletchford

@benletchford benletchford commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Cause

Systemless accumulated Window Manager activate events in an unbounded FIFO and only activated frontmost windows created visible. Classic Window Manager state instead has one replaceable CurActivate slot and one replaceable CurDeactive slot. During rapid window changes, the FIFO retained stale window pointers long enough for application-owned callback storage to be reused, eventually sending execution through address zero.

Fix

  • Coalesce pending activation and deactivation events through their documented low-memory slots.
  • Clear a slot when its corresponding event is delivered.
  • Activate a window created frontmost even when it starts invisible.
  • Route the remaining dialog/window activation paths through the same model.

Evidence

The Civilization II demo now proceeds through initial world generation, dismisses the first map dialog, and remains responsive to subsequent input without jumping to PC zero. Its separate terrain-rendering defect is tracked in #600 and is not changed here.

Tests

  • cargo fmt --check
  • cargo test trap::window::tests (177 passed)
  • cargo test --lib (2,951 passed; 3 ignored)

Closes #597

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.

Civilization II jumps through a null dialog callback on the first map

1 participant