diff --git a/komorebi/src/stackbar_manager/stackbar.rs b/komorebi/src/stackbar_manager/stackbar.rs index ac51e335..f926c3f7 100644 --- a/komorebi/src/stackbar_manager/stackbar.rs +++ b/komorebi/src/stackbar_manager/stackbar.rs @@ -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 =