Fix UDP terminal handling and X11/libevent cleanup - #105
Conversation
Store the X11 event in the global guard so frames do not repeatedly create events or re-grab hotkeys. Assisted-by: OpenAI GPT-5.6 Terra
Tear down renderer resources before freeing the shared event base, and make renderer cleanup safe for both XShm and fallback paths. Assisted-by: OpenAI GPT-5.6 Terra
Use -1 for the absent UART descriptor and configure termios only after opening a real serial port. Assisted-by: OpenAI GPT-5.6 Terra
PR Summary by QodoFix UDP terminal handling and X11/libevent shutdown ownership
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Ungated XGrabKey on failure
|
| if (x11_event) | ||
| event_add(x11_event, NULL); | ||
|
|
||
| XGrabKey(display, XKeysymToKeycode(display, XK_Up), Mod1Mask, RootWindow, True, |
There was a problem hiding this comment.
1. Ungated xgrabkey on failure 🐞 Bug ☼ Reliability
In FlushDrawing(), XGrabKey() executes even if event_new() fails, leaving x11_event NULL; since FlushDrawing() is called repeatedly, this can cause repeated hotkey-grab attempts every frame without ever registering the X11 fd with libevent. This can create noisy X11 errors/unnecessary work and still leaves keyboard event handling disabled.
Agent Prompt
### Issue description
`FlushDrawing()` unconditionally calls `XGrabKey()` after attempting `event_new()`. If `event_new()` (or `event_add()`) fails, `x11_event` remains `NULL`, and the next `FlushDrawing()` call will retry and repeatedly attempt key grabs every frame.
### Issue Context
This code runs in the render loop; `FlushDrawing()` is invoked repeatedly during normal operation.
### Fix Focus Areas
- osd/util/Render_gs.c[516-530]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Fixes several lifecycle and resource-management issues:
Assisted by: OpenAI Codex 5.6