1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed a resource leak in hardware cursor emulation

See issue #148.
This commit is contained in:
narzoul 2022-12-21 22:34:22 +01:00
parent 83941ddb8e
commit 122224450a

View File

@ -93,7 +93,8 @@ namespace D3dDdi
SurfaceRepository::Cursor SurfaceRepository::getCursor(HCURSOR cursor)
{
if (isLost(m_cursorMaskTexture) || isLost(m_cursorColorTexture))
if (m_cursorMaskTexture.resource && isLost(m_cursorMaskTexture) ||
m_cursorColorTexture.resource && isLost(m_cursorColorTexture))
{
m_cursor = nullptr;
m_cursorMaskTexture = {};
@ -109,6 +110,8 @@ namespace D3dDdi
{
return {};
}
std::unique_ptr<void, decltype(&DeleteObject)> bmColor(iconInfo.hbmColor, DeleteObject);
std::unique_ptr<void, decltype(&DeleteObject)> bmMask(iconInfo.hbmMask, DeleteObject);
m_cursorHotspot.x = iconInfo.xHotspot;
m_cursorHotspot.y = iconInfo.yHotspot;