Fixed leak on shutdown (fixes #110) + possible uninitialized member.

This commit is contained in:
ocornut 2015-01-07 14:55:35 +00:00
parent c1251d2994
commit 26fdf1655c

View File

@ -1504,6 +1504,7 @@ void ImGui::NewFrame()
IM_ASSERT(g.IO.Font->Scale > 0.0f); IM_ASSERT(g.IO.Font->Scale > 0.0f);
g.FontSize = g.IO.FontGlobalScale * (float)g.IO.Font->Info->FontSize * g.IO.Font->Scale; g.FontSize = g.IO.FontGlobalScale * (float)g.IO.Font->Info->FontSize * g.IO.Font->Scale;
g.FontTexUvForWhite = g.IO.Font->TexUvForWhite; g.FontTexUvForWhite = g.IO.Font->TexUvForWhite;
g.IO.Font->FallbackGlyph = NULL; // Because subsequent FindGlyph may return the fallback itself.
g.IO.Font->FallbackGlyph = g.IO.Font->FindGlyph(g.IO.Font->FallbackChar); g.IO.Font->FallbackGlyph = g.IO.Font->FindGlyph(g.IO.Font->FallbackChar);
g.Time += g.IO.DeltaTime; g.Time += g.IO.DeltaTime;
@ -1649,6 +1650,8 @@ void ImGui::Shutdown()
ImGui::MemFree(g.Settings[i]); ImGui::MemFree(g.Settings[i]);
} }
g.Settings.clear(); g.Settings.clear();
g.ColorModifiers.clear();
g.StyleModifiers.clear();
g.ColorEditModeStorage.Clear(); g.ColorEditModeStorage.Clear();
if (g.LogFile && g.LogFile != stdout) if (g.LogFile && g.LogFile != stdout)
{ {
@ -6109,6 +6112,7 @@ ImFont::ImFont()
GlyphsCount = 0; GlyphsCount = 0;
Kerning = NULL; Kerning = NULL;
KerningCount = 0; KerningCount = 0;
FallbackGlyph = NULL;
} }
void ImFont::Clear() void ImFont::Clear()
@ -6123,6 +6127,7 @@ void ImFont::Clear()
GlyphsCount = 0; GlyphsCount = 0;
Filenames.clear(); Filenames.clear();
IndexLookup.clear(); IndexLookup.clear();
FallbackGlyph = NULL;
} }
bool ImFont::LoadFromFile(const char* filename) bool ImFont::LoadFromFile(const char* filename)