From 49f7d2494ce178162a96da57315ad41f6c2796c6 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 17 Dec 2021 23:49:47 +0100 Subject: Protect font initialization with mutex fixes #4532 --- src/client/fontengine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/client/fontengine.h') diff --git a/src/client/fontengine.h b/src/client/fontengine.h index 3d389ea48..403ac2e48 100644 --- a/src/client/fontengine.h +++ b/src/client/fontengine.h @@ -20,13 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include -#include #include "util/basic_macros.h" #include "irrlichttypes.h" #include #include #include #include "settings.h" +#include "threading/mutex_auto_lock.h" #define FONT_SIZE_UNSPECIFIED 0xFFFFFFFF @@ -152,6 +152,9 @@ private: /** pointer to irrlicht gui environment */ gui::IGUIEnvironment* m_env = nullptr; + /** mutex used to protect font init and cache */ + std::recursive_mutex m_font_mutex; + /** internal storage for caching fonts of different size */ std::map m_font_cache[FM_MaxMode << 2]; -- cgit v1.2.3