amiagent 0.5.1 — hold the screen while capturing it
Upgrade if you run 0.5.0. This fixes a crash that could take the whole machine down.
nth_screen() took a Screen pointer under Forbid(), called Permit(), and returned it; do_shot() then dereferenced scr->RastPort.BitMap with nothing keeping that screen open. If the screen closed in between, the agent read freed memory — which on AmigaOS does not fail politely, it takes the machine with it.
The window is exactly when a program is starting up or dying, which is precisely when something is most likely to be capturing the screen to find out what went wrong. This crash-rebooted an A4000 while ScummVM was opening its screen, and stalled it several times before that. The evening was spent blaming ScummVM.
The pattern is older than 0.5.0, but 0.5.0 is what made it easy to reach: region capture and hashing are cheap, so polling got aggressive, so the race got hit.
The fix
The screen is re-validated against Intuition's list, and the pixel read runs with the task switcher held off. Buffers are allocated beforehand so nothing inside the Forbid() can break it, and the socket write — the slow part — happens after Permit(). A screen that closes mid-capture is now reported as an error instead of taking the machine with it.
Verified on hardware
66 polls of screens/region_hash/screenshot at roughly 8 per second while a 640×256 screen was closed underneath them — zero errors, machine alive. That sequence reliably killed it before.