1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Disposed more bitmaps

This commit is contained in:
Darth Affe 2016-06-14 21:50:04 +02:00
parent 2420aa6bc4
commit 96f9daff25

View File

@ -89,7 +89,6 @@ namespace Artemis.DeviceProviders.Corsair
// For STRAFE, stretch the image on row 2. // For STRAFE, stretch the image on row 2.
if (_keyboard.DeviceInfo.Model == "STRAFE RGB") if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
{ {
//TODO DarthAffe 13.06.2016: This might leak memory since it's not disposed, but I don't want to change it without the ability to test if it still works
var strafeBitmap = new Bitmap(22, 8); var strafeBitmap = new Bitmap(22, 8);
using (var g = Graphics.FromImage(strafeBitmap)) using (var g = Graphics.FromImage(strafeBitmap))
{ {
@ -97,11 +96,14 @@ namespace Artemis.DeviceProviders.Corsair
g.DrawImage(image, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7), GraphicsUnit.Pixel); g.DrawImage(image, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7), GraphicsUnit.Pixel);
} }
image.Dispose();
image = strafeBitmap; image = strafeBitmap;
} }
_keyboardBrush.Image = image; _keyboardBrush.Image = image;
_keyboard.Update(); _keyboard.Update();
image.Dispose();
} }
} }
} }