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

Fixed resource leak in PrimarySurface::getLastSurface()

This commit is contained in:
narzoul 2021-04-08 01:10:11 +02:00
parent 6396b7420d
commit fc0b904c25
2 changed files with 9 additions and 1 deletions

View File

@ -106,6 +106,13 @@ namespace Compat
getOrigVtable(&origIntf).QueryInterface(&origIntf, getIntfId<NewIntf>(), reinterpret_cast<void**>(&newIntf));
}
template <typename Intf>
void queryInterface(Intf& origIntf, Intf*& newIntf)
{
newIntf = &origIntf;
getOrigVtable(newIntf).AddRef(newIntf);
}
template <typename NewIntf, typename OrigIntf>
NewIntf* queryInterface(OrigIntf* origIntf)
{

View File

@ -163,7 +163,8 @@ namespace DDraw
while (SUCCEEDED(surface->GetAttachedSurface(surface, &caps, &nextSurface.getRef())) &&
nextSurface != g_primarySurface)
{
surface = nextSurface;
surface.swap(nextSurface);
nextSurface.release();
}
return surface;