Make sure Fonts are disposed (need to free textures!)
This commit is contained in:
1 parent
9ca577e0da
commit
9aafd6f82c
2 files changed
+17
-7
No files matched your search
@@ -34,6 +34,8 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
|
|
||||||
private readonly string _FilePath;
|
private readonly string _FilePath;
|
||||||
|
|
||||||
|
private bool _Disposed;
|
||||||
|
|
||||||
public CFont(string file)
|
public CFont(string file)
|
||||||
{
|
{
|
||||||
_FilePath = file;
|
_FilePath = file;
|
||||||
@@ -135,11 +137,12 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_Fonts != null)
|
if (!_Disposed)
|
||||||
{
|
{
|
||||||
_Fonts.Dispose();
|
if (_Fonts != null)
|
||||||
_Fonts = null;
|
_Fonts.Dispose();
|
||||||
UnloadGlyphs();
|
UnloadGlyphs();
|
||||||
|
_Disposed = true;
|
||||||
}
|
}
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
{
|
{
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||||
|
|
||||||
private static List<SFont> _Fonts;
|
private static readonly List<SFont> _Fonts = new List<SFont>();
|
||||||
private static int _CurrentFont;
|
private static int _CurrentFont;
|
||||||
private static float _Height = 1f;
|
private static float _Height = 1f;
|
||||||
|
|
||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
public static int PartyModeID { get; set; }
|
public static int PartyModeID { get; set; }
|
||||||
|
// ReSharper restore MemberCanBePrivate.Global
|
||||||
|
|
||||||
public static EStyle Style = EStyle.Normal;
|
public static EStyle Style = EStyle.Normal;
|
||||||
|
|
||||||
@@ -68,7 +70,14 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
|
|
||||||
private static void _BuildFonts()
|
private static void _BuildFonts()
|
||||||
{
|
{
|
||||||
_Fonts = new List<SFont>();
|
foreach (var font in _Fonts)
|
||||||
|
{
|
||||||
|
font.Normal.Dispose();
|
||||||
|
font.Bold.Dispose();
|
||||||
|
font.Italic.Dispose();
|
||||||
|
font.BoldItalic.Dispose();
|
||||||
|
}
|
||||||
|
_Fonts.Clear();
|
||||||
_CurrentFont = 0;
|
_CurrentFont = 0;
|
||||||
|
|
||||||
_LoadFontList();
|
_LoadFontList();
|
||||||
@@ -344,8 +353,6 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_Fonts.Clear();
|
|
||||||
|
|
||||||
_LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderFonts));
|
_LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderFonts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user