Some checks failed
CI Code / Check spelling (pull_request) Successful in 53s
CI Code / Check coding style (pull_request) Successful in 1m11s
CI Code / Linux (debian) (pull_request) Failing after 2m58s
CI Code / Linux (arch) (pull_request) Failing after 3m11s
CI Code / Linux (ubuntu) (pull_request) Failing after 3m10s
CI Code / Code Coverage (pull_request) Successful in 2m46s
Prevent use-after-free in the AI request worker thread when the user closes the AI window during the 60-second HTTP request timeout. Without this fix, the worker may dereference a dangling pointer and crash or exhibit undefined behavior. The _ai_request_thread function in ai_client.c previously cast user_data to ProfAiWin* and used it directly without verifying the window was still alive. Added wins_ai_exists() to iterate through all AI windows and check if the pointer is still valid before use. Safety: - wins_ai_exists() iterates all AI windows (handles multiple AI windows) - Worker skips UI update if window was freed, just cleans up - Logs warning when dangling pointer is detected