Fixed possible memoryleak in loopmanager

This commit is contained in:
DarthAffe committed 2016-06-12 11:53:01 +02:00
1 parent eba34be67b
commit c61d0ddac3
1 file changed
+12 -9
+12 -9
View File
@@ -144,17 +144,20 @@ namespace Artemis.Managers
return; return;
// Fill the bitmap's background with black to avoid trailing colors on some keyboards // Fill the bitmap's background with black to avoid trailing colors on some keyboards
var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height); // Bitmaps needs to be disposd!
using (var g = Graphics.FromImage(fixedBmp)) using (var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height))
{ {
g.Clear(Color.Black); using (var g = Graphics.FromImage(fixedBmp))
g.DrawImage(bitmap, 0, 0); {
g.Clear(Color.Black);
g.DrawImage(bitmap, 0, 0);
}
bitmap = fixedBmp;
// Update the keyboard
_deviceManager.ActiveKeyboard?.DrawBitmap(bitmap);
} }
bitmap = fixedBmp;
// Update the keyboard
_deviceManager.ActiveKeyboard?.DrawBitmap(bitmap);
} }
} }
} }