From d70bfe70913602de016e14d17d4ac485a8683cf5 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 6 Apr 2015 09:58:33 +0200 Subject: added locks around cTextWrappers to avoid crashed when concurrently accessing fonts --- libcore/helpers.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libcore') diff --git a/libcore/helpers.c b/libcore/helpers.c index 5dc5156..9604e3a 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -51,8 +51,10 @@ int Minimum(int a, int b, int c, int d, int e, int f) { string CutText(string &text, int width, string fontName, int fontSize) { if (width <= fontManager->Font(fontName, fontSize)->Size()) return text.c_str(); + fontManager->Lock(); cTextWrapper twText; twText.Set(text.c_str(), fontManager->Font(fontName, fontSize), width); + fontManager->Unlock(); string cuttedTextNative = twText.GetLine(0); stringstream sstrText; sstrText << cuttedTextNative << "..."; -- cgit v1.2.3