Skip to content

Commit

Permalink
Fix another deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Mar 19, 2017
1 parent d949118 commit 2952ccf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/script/dom/cssrulelist.rs
Expand Up @@ -90,9 +90,12 @@ impl CSSRuleList {
let index = idx as usize;

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

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

0 comments on commit 2952ccf

Please sign in to comment.