aboutsummaryrefslogtreecommitdiff
path: root/src/client/fontengine.h
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-12-17 23:49:47 +0100
committersfan5 <sfan5@live.de>2021-12-18 20:38:33 +0100
commit49f7d2494ce178162a96da57315ad41f6c2796c6 (patch)
treebd49cbfdfa65bf8f1a2c9cd11147fbe79ad281af /src/client/fontengine.h
parentb2409b14d0682655363c1b3b3b6bafbaa7e7c1bf (diff)
downloadminetest-49f7d2494ce178162a96da57315ad41f6c2796c6.tar.gz
minetest-49f7d2494ce178162a96da57315ad41f6c2796c6.tar.bz2
minetest-49f7d2494ce178162a96da57315ad41f6c2796c6.zip
Protect font initialization with mutex
fixes #4532
Diffstat (limited to 'src/client/fontengine.h')
-rw-r--r--src/client/fontengine.h5
1 files changed, 4 insertions, 1 deletions
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 <map>
-#include <vector>
#include "util/basic_macros.h"
#include "irrlichttypes.h"
#include <IGUIFont.h>
#include <IGUISkin.h>
#include <IGUIEnvironment.h>
#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<unsigned int, irr::gui::IGUIFont*> m_font_cache[FM_MaxMode << 2];