diff options
| author | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-04-11 19:06:35 +0900 |
| commit | 93f50d20a021150a0b95242be0d5dd5cae9d0185 (patch) | |
| tree | 48054581d580974651260900d1ef79d370872952 /.rules/plan/phase-10-robustness.md | |
| download | winman-raylib-93f50d20a021150a0b95242be0d5dd5cae9d0185.tar.gz winman-raylib-93f50d20a021150a0b95242be0d5dd5cae9d0185.zip | |
plan and researchmain
Diffstat (limited to '.rules/plan/phase-10-robustness.md')
| -rw-r--r-- | .rules/plan/phase-10-robustness.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.rules/plan/phase-10-robustness.md b/.rules/plan/phase-10-robustness.md new file mode 100644 index 0000000..39c719d --- /dev/null +++ b/.rules/plan/phase-10-robustness.md @@ -0,0 +1,48 @@ +# Phase 10 — Robustness & Cleanup + +--- + +## Step 10.1 — Proper error handling + +- Set `XSetErrorHandler()` to a handler that logs but doesn't crash on + `BadWindow`, `BadPixmap`, `BadDrawable` (windows can vanish between + operations). +- Wrap all X calls that reference a window in the handler's + error-checked scope. +- On fatal errors (`XSetIOErrorHandler`), clean up gracefully. + +**Verify:** Rapidly spawn and kill clients (a stress loop script). No +crashes, no X error floods. Clean log output. + +--- + +## Step 10.2 — Clean shutdown + +On `SIGINT`/`SIGTERM` or raylib `WindowShouldClose()`: + +1. Unredirect all windows (`XCompositeUnredirectSubwindows`). +2. Free all pixmaps, textures, damage objects. +3. Release the overlay (if used later). +4. `XCloseDisplay()`. +5. `CloseWindow()` (raylib). + +**Verify:** Killing the WM with Ctrl+C cleanly restores windows in +Xephyr (they become visible via X's normal rendering again). No +orphaned resources. + +--- + +## Step 10.3 — Stress test script + +Create `bin/stress-test.sh` that: + +1. Starts Xephyr. +2. Starts the WM. +3. Rapidly spawns 20 `xterm` instances. +4. Randomly moves, resizes, and closes them via `xdotool`. +5. Checks that `wmctrl -l` count matches expectations. +6. Screenshots the result. +7. Tears everything down. + +**Verify:** No crashes, no hangs, no leaked windows. Screenshot looks +sane. |
