fix(stackbar): drop containers lock before repositioning stackbar

Stackbar::update held STACKBARS_CONTAINERS across the synchronous
cross-thread SetWindowPos in position_window, while the stackbar wndproc
acquires the same lock on WM_LBUTTONDOWN. A tab click racing an update
storm leaves the wndproc blocked on the lock and the updater blocked in
SetWindowPos waiting on the wndproc's message pump, deadlocking the
whole process. Scope the guard to the insert so the lock is released
before SetWindowPos.

Fixes #1734
This commit is contained in:
Dylan Anderson
2026-08-02 20:24:18 -07:00
committed by Jeezy
parent 1b263b9496
commit 5a534eb2ac
+8 -2
View File
@@ -174,8 +174,14 @@ impl Stackbar {
let focused_text_colour = STACKBAR_FOCUSED_TEXT_COLOUR.load_consume();
let unfocused_text_colour = STACKBAR_UNFOCUSED_TEXT_COLOUR.load_consume();
let mut stackbars_containers = STACKBARS_CONTAINERS.lock();
stackbars_containers.insert(self.hwnd, container.clone());
// Scope the lock so it is released before the synchronous position_window
// call below; the window's wndproc takes the same lock on WM_LBUTTONDOWN,
// and holding it across a cross-thread SetWindowPos deadlocks the two
// threads against each other (mutex <-> message queue cycle)
{
let mut stackbars_containers = STACKBARS_CONTAINERS.lock();
stackbars_containers.insert(self.hwnd, container.clone());
}
let mut layout = *layout;
let workspace_specific_offset =