diff --git a/components/layout/context.rs b/components/layout/context.rs index e7e0ab070b8..5a7bbdfed8f 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -62,8 +62,9 @@ fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) } context } else { + let font_cache_task = shared_layout_context.font_cache_task.lock().unwrap().clone(); let context = Rc::new(LocalLayoutContext { - font_context: RefCell::new(FontContext::new(shared_layout_context.font_cache_task.clone())), + font_context: RefCell::new(FontContext::new(font_cache_task)), applicable_declarations_cache: RefCell::new(ApplicableDeclarationsCache::new()), style_sharing_candidate_cache: RefCell::new(StyleSharingCandidateCache::new()), }); @@ -88,7 +89,7 @@ pub struct SharedLayoutContext { pub screen_size_changed: bool, /// Interface to the font cache task. - pub font_cache_task: FontCacheTask, + pub font_cache_task: Mutex, /// The CSS selector stylist. /// @@ -121,7 +122,6 @@ pub struct SharedLayoutContext { // FIXME(#6569) This implementations is unsound: // XXX UNSOUND!!! for image_cache_task -// XXX UNSOUND!!! for font_cache_task // XXX UNSOUND!!! for stylist // XXX UNSOUND!!! for new_animations_sender // XXX UNSOUND!!! for canvas_layers_sender diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 58e4a6f5639..edf408cf937 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -455,7 +455,7 @@ impl LayoutTask { image_cache_sender: Mutex::new(self.image_cache_sender.clone()), viewport_size: rw_data.viewport_size.clone(), screen_size_changed: screen_size_changed, - font_cache_task: self.font_cache_task.clone(), + font_cache_task: Mutex::new(self.font_cache_task.clone()), canvas_layers_sender: self.canvas_layers_sender.clone(), stylist: &*rw_data.stylist, url: (*url).clone(),