[librsvg: 42/53] FontMap::set_default is per-thread, so don't do it in a Once




commit 013e9f41e81b5e43a38caa2430f024a7cd9c05ff
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Oct 22 10:50:17 2020 -0500

    FontMap::set_default is per-thread, so don't do it in a Once
    
    Per the docs of pango_cairo_font_map_set_default():
    
     * Note that since Pango 1.32.6, the default fontmap is per-thread.
     * This function only changes the default fontmap for
     * the current thread.  Default fontmaps of existing threads
     * are not changed. Default fontmaps of any new threads will
     * still be created using pango_cairo_font_map_new().
    
    This gets us down to 1 test failure, that for the system language.  Yay!

 tests/src/utils.rs | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/tests/src/utils.rs b/tests/src/utils.rs
index a6e72f5e..d2628098 100644
--- a/tests/src/utils.rs
+++ b/tests/src/utils.rs
@@ -5,7 +5,6 @@ use libc;
 use std::env;
 use std::ffi::CString;
 use std::path::PathBuf;
-use std::sync::Once;
 
 #[cfg(have_pangoft2)]
 
@@ -78,11 +77,9 @@ mod pango_ft2 {
 
 #[cfg(have_pangoft2)]
 pub fn setup_font_map() {
-    static ONCE: Once = Once::new();
-
-    ONCE.call_once(|| unsafe {
+    unsafe {
         self::pango_ft2::load_test_fonts();
-    });
+    }
 }
 
 #[cfg(not(have_pangoft2))]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]