mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 03:19:56 +00:00
Fixed possible memoryleak in loopmanager
This commit is contained in:
1 parent
eba34be67b
commit
c61d0ddac3
1 file changed
+12
-9
@@ -144,17 +144,20 @@ namespace Artemis.Managers
|
||||
return;
|
||||
|
||||
// Fill the bitmap's background with black to avoid trailing colors on some keyboards
|
||||
var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height);
|
||||
using (var g = Graphics.FromImage(fixedBmp))
|
||||
// Bitmaps needs to be disposd!
|
||||
using (var fixedBmp = new Bitmap(bitmap.Width, bitmap.Height))
|
||||
{
|
||||
g.Clear(Color.Black);
|
||||
g.DrawImage(bitmap, 0, 0);
|
||||
using (var g = Graphics.FromImage(fixedBmp))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user