Skip to content

Commit a7c14f5

Browse files
committed
rely on FT_Library being a pointer
1 parent f800e6b commit a7c14f5

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/irrlicht_changes/CGUITTFont.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,25 @@
4242

4343
#include <cstdlib>
4444
#include <iostream>
45-
#include <optional>
4645

4746
namespace irr
4847
{
4948
namespace gui
5049
{
5150

5251
std::map<io::path, SGUITTFace*> SGUITTFace::faces;
53-
std::optional<FT_Library> SGUITTFace::freetype_library;
54-
std::size_t SGUITTFace::n_faces;
52+
FT_Library SGUITTFace::freetype_library = nullptr;
53+
std::size_t SGUITTFace::n_faces = 0;
5554

5655
FT_Library SGUITTFace::getFreeTypeLibrary()
5756
{
5857
if (freetype_library)
59-
return *freetype_library;
58+
return freetype_library;
6059
FT_Library ft;
6160
if (FT_Init_FreeType(&ft))
6261
FATAL_ERROR("initializing freetype failed");
6362
freetype_library = ft;
64-
return *freetype_library;
63+
return freetype_library;
6564
}
6665

6766
SGUITTFace::SGUITTFace(std::string &&buffer) : face_buffer(std::move(buffer))
@@ -77,8 +76,8 @@ SGUITTFace::~SGUITTFace()
7776
// If there are no more faces referenced by FreeType, clean up.
7877
if (n_faces == 0) {
7978
assert(freetype_library);
80-
FT_Done_FreeType(*freetype_library);
81-
freetype_library = std::nullopt;
79+
FT_Done_FreeType(freetype_library);
80+
freetype_library = nullptr;
8281
}
8382
}
8483

src/irrlicht_changes/CGUITTFont.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace gui
5656
private:
5757

5858
static std::map<io::path, SGUITTFace*> faces;
59-
static std::optional<FT_Library> freetype_library;
59+
static FT_Library freetype_library;
6060
static std::size_t n_faces;
6161

6262
static FT_Library getFreeTypeLibrary();

0 commit comments

Comments
 (0)