[librsvg: 36/53] Wrap the fontmap setting process in sync::Once
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 36/53] Wrap the fontmap setting process in sync::Once
- Date: Fri, 23 Oct 2020 02:19:07 +0000 (UTC)
commit 188f216a5221776655c5d1c445861374179a9e30
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Oct 21 19:07:27 2020 -0500
Wrap the fontmap setting process in sync::Once
tests/src/utils.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/tests/src/utils.rs b/tests/src/utils.rs
index aa87be00..305fc7c8 100644
--- a/tests/src/utils.rs
+++ b/tests/src/utils.rs
@@ -4,6 +4,7 @@ use glib::translate::*;
use libc;
use std::env;
use std::path::PathBuf;
+use std::sync::Once;
#[cfg(have_pangoft2)]
@@ -72,7 +73,11 @@ mod pango_ft2 {
#[cfg(have_pangoft2)]
pub fn setup_font_map() {
- unsafe { self::pango_ft2::load_test_fonts(); }
+ static ONCE: Once = Once::new();
+
+ ONCE.call_once(|| 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]