fix(kde): take the rule locks in one order, so a rule check and a config load cannot deadlock

window.rs and static_config.rs locked the float, manage and other rule lists in conflicting orders, which deadlocked KDE tests and could in the daemon. Both now take the locks in one order. Found by test hangs during the merge work. The Windows and macOS trees have the same pattern by reading and were not changed. Verified: the KDE test suite no longer hangs; the VM tier was not re-run.
This commit is contained in:
LGUG2Z committed 2026-10-31 01:37:53 -07:00
1 parent b38a26f289
commit ef1d3ef096
2 files changed
+11 -7

No files matched your search

@@ -993,16 +993,18 @@ impl StaticConfig {
transparency_manager::TRANSPARENCY_ALPHA
.store(self.transparency_alpha.unwrap_or(200), Ordering::SeqCst);
// the order every other place takes them in (floating, transparency, ignore, manage, regex):
// a thread that takes two in another order can wait for one that holds what it needs
let mut floating_applications = FLOATING_APPLICATIONS.lock();
let mut transparency_blacklist = TRANSPARENCY_BLACKLIST.lock();
let mut ignore_identifiers = IGNORE_IDENTIFIERS.lock();
let mut regex_identifiers = REGEX_IDENTIFIERS.lock();
let mut manage_identifiers = MANAGE_IDENTIFIERS.lock();
let mut regex_identifiers = REGEX_IDENTIFIERS.lock();
// let mut tray_and_multi_window_identifiers = TRAY_AND_MULTI_WINDOW_IDENTIFIERS.lock();
// let mut object_name_change_identifiers = OBJECT_NAME_CHANGE_ON_LAUNCH.lock();
// let mut object_name_change_title_ignore_list = OBJECT_NAME_CHANGE_TITLE_IGNORE_LIST.lock();
// let mut layered_identifiers = LAYERED_WHITELIST.lock();
let mut transparency_blacklist = TRANSPARENCY_BLACKLIST.lock();
// let mut slow_application_identifiers = SLOW_APPLICATION_IDENTIFIERS.lock();
let mut floating_applications = FLOATING_APPLICATIONS.lock();
// let mut no_titlebar_applications = NO_TITLEBAR.lock();
if let Some(rules) = &mut self.ignore_rules {
+6 -4
View File
@@ -529,9 +529,13 @@ fn window_is_eligible(
}
}
let regex_identifiers = REGEX_IDENTIFIERS.lock();
// Every place that holds two of the rule lists takes them in this order: floating, transparency,
// ignore, manage, regex. A thread that takes two in another order can wait for one that holds
// what it needs, and both wait for ever.
let floating_identifiers = FLOATING_APPLICATIONS.lock();
let ignore_identifiers = IGNORE_IDENTIFIERS.lock();
let manage_identifiers = MANAGE_IDENTIFIERS.lock();
let regex_identifiers = REGEX_IDENTIFIERS.lock();
let should_ignore = if let Some(rule) = should_act(
title,
exe_name,
@@ -546,7 +550,6 @@ fn window_is_eligible(
false
};
let manage_identifiers = MANAGE_IDENTIFIERS.lock();
let managed_override = if let Some(rule) = should_act(
title,
exe_name,
@@ -561,7 +564,6 @@ fn window_is_eligible(
false
};
let floating_identifiers = FLOATING_APPLICATIONS.lock();
if let Some(rule) = should_act(
title,
exe_name,