Skip to content

Commit 2952ccf

Browse files
committed
Fix another deadlock
1 parent d949118 commit 2952ccf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/script/dom/cssrulelist.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,12 @@ impl CSSRuleList {
9090
let index = idx as usize;
9191

9292
let parent_stylesheet = self.parent_stylesheet.style_stylesheet();
93-
let mut guard = parent_stylesheet.shared_lock.write();
94-
let new_rule = css_rules.write_with(&mut guard)
95-
.insert_rule(rule, parent_stylesheet, index, nested)?;
93+
let new_rule = {
94+
let mut guard = parent_stylesheet.shared_lock.write();
95+
css_rules.write_with(&mut guard).insert_rule(rule, parent_stylesheet, index, nested)?
96+
// Drop `guard` here,
97+
// CSSRule::new_specific re-acquires the lock for @support and @media.
98+
};
9699

97100
let parent_stylesheet = &*self.parent_stylesheet;
98101
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);

0 commit comments

Comments
 (0)