Fixed some memory leaks from Bitmaps

This commit is contained in:
Stephan Sundermann committed 2013-01-10 14:29:52 +01:00
1 parent 9c3f1d9ebd
commit c95214ba06
3 files changed
+8 -1

No files matched your search

+4
View File
@@ -1187,6 +1187,8 @@ namespace Vocaluxe.Base
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(origin, new Rectangle(0, 0, w, h));
g.Dispose();
if (origin != null)
origin.Dispose();
byte[] data = new byte[w * h * 4];
@@ -1484,6 +1486,8 @@ namespace Vocaluxe.Base
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(origin, new Rectangle(0, 0, w, h));
g.Dispose();
if (origin != null)
origin.Dispose();
tex = CDraw.AddTexture(bmp);
byte[] data = new byte[w * h * 4];
+1
View File
@@ -178,6 +178,7 @@ namespace Vocaluxe.Base
Bitmap bmp = new Bitmap(origin, w, h);
STexture tex = _Draw.AddTexture(bmp);
bmp.Dispose();
origin.Dispose();
return tex;
}
+3 -1
View File
@@ -881,7 +881,9 @@ namespace Vocaluxe.Lib.Draw
CLog.LogError("Error loading Texture: " + TexturePath);
return new STexture(-1);
}
return AddTexture(bmp, TexturePath);
STexture s = AddTexture(bmp, TexturePath);
bmp.Dispose();
return s;
}
CLog.LogError("Can't find File: " + TexturePath);
return new STexture(-1);