Skip to content

Commit 7724001

Browse files
committed
fixing segfault at exit
1 parent 1721632 commit 7724001

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

runtime/Includes/Core/Graphics.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ namespace mlx
4343
Text& new_text = p_scene->CreateText(str);
4444
new_text.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
4545
new_text.SetColor(std::move(vec_color));
46-
if(m_pixelput_called)
46+
// if(m_pixelput_called)
4747
{
4848
m_draw_layer++;
49-
m_pixelput_called = false;
49+
// m_pixelput_called = false;
5050
}
5151
}
5252
else if(!p_scene->IsTextAtGivenDrawLayer(str, m_draw_layer))

runtime/Includes/Graphics/Font.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace mlx
3939
inline void RegisterFont(std::shared_ptr<Font> font);
4040
inline void UnregisterFont(std::shared_ptr<Font> font);
4141
inline std::shared_ptr<Font> GetFont(const std::filesystem::path& name, float scale);
42+
inline void Reset();
4243

4344
~FontRegistry() = default;
4445

runtime/Includes/Graphics/Font.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ namespace mlx
2121
});
2222
return (it != m_fonts_registry.end() ? *it : nullptr);
2323
}
24+
25+
void FontRegistry::Reset()
26+
{
27+
m_fonts_registry.clear();
28+
}
2429
}

runtime/Sources/Core/Application.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ namespace mlx
103103
window.reset();
104104
}
105105

106+
m_font_registry.Reset();
106107
p_render_core.reset();
107108
p_sdl_manager.reset();
108109
#ifdef PROFILER

0 commit comments

Comments
 (0)