The library grid never got the FlowBox recursion guard, so every game click overflowed the stack #264

Merged
enricobuehler merged 1 commits from worktree-gtk-library-card-activation-overflow into main 2026-08-16 08:46:58 +00:00
1 Commits
Author SHA1 Message Date
enricobuehler 9e71cda298 fix(client-linux): the library grid never got the FlowBox recursion guard, so every game click overflowed the stack
ci / web (pull_request) Successful in 1m27s
ci / docs-site (pull_request) Successful in 1m15s
ci / bun-nix (pull_request) Successful in 22s
ci / rust-arm64 (pull_request) Successful in 15m19s
ci / rust (pull_request) Successful in 29m27s
Clicking any game in the host library aborted punktfunk-client outright:

    thread 'main' has overflowed its stack
    fatal runtime error: stack overflow, aborting

A click on a FlowBoxChild emits `child-activated` on the *FlowBox*, never the
child's own `activate`, so a grid whose per-card handler hangs off
`child.connect_activate()` has to bridge the two. The naive bridge is a cycle:
FlowBoxChild's default `activate` handler re-emits `child-activated` on its
parent, which re-enters the bridge, which activates the child again.

53c8eefa fixed exactly this for the host cards — but only in ui_hosts.rs. The
library page had carried the same unguarded bridge since 7eea9836, and 883c3178
then added a third one for the launcher shelf. So the guard existed in one of
three places, and both library grids still aborted on the first click.

Rather than patch the two sites and leave the footgun loaded, the guarded bridge
moves into ui_flow.rs and all three call sites go through it. The regression test
moves with it, so it now covers the code both pages actually run instead of a
hand-copied replica of it — which is why it never caught this.

Verified in a Linux container (fmt / clippy -D warnings / build / test all green)
with the display test executed for real against Xvfb rather than skipped. Removing
the guard again reproduces the reported abort exactly (SIGABRT, stack overflow),
so the test is known to catch the bug rather than merely pass.
2026-08-16 09:56:34 +02:00