mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
Fixed possible memoryleak in loopmanager
This commit is contained in:
parent
eba34be67b
commit
c61d0ddac3
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user