From 6b2097e8720a3bd8b5ca104bb70a10ed24178522 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 4 Dec 2025 19:44:39 -0800 Subject: [PATCH] core: hold lock during keyCallback when mouseRefreshLinks is called From #9812 I'm not sure if this is the root cause of the crash in #9812 but the LLM-discovered issue that we are not holding a lock here appears to be a real issue. I manually traced the code paths and thought about this and looked where we call `mouseRefreshLinks` in other places and this appears to be a real bug. --- src/Surface.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Surface.zig b/src/Surface.zig index 18eac39ca..1926c4394 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -2592,6 +2592,8 @@ pub fn keyCallback( { // Refresh our link state const pos = self.rt_surface.getCursorPos() catch break :mouse_mods; + self.renderer_state.mutex.lock(); + defer self.renderer_state.mutex.unlock(); self.mouseRefreshLinks( pos, self.posToViewport(pos.x, pos.y),