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:
parent
6396b7420d
commit
fc0b904c25
@ -106,6 +106,13 @@ namespace Compat
|
|||||||
getOrigVtable(&origIntf).QueryInterface(&origIntf, getIntfId<NewIntf>(), reinterpret_cast<void**>(&newIntf));
|
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>
|
template <typename NewIntf, typename OrigIntf>
|
||||||
NewIntf* queryInterface(OrigIntf* origIntf)
|
NewIntf* queryInterface(OrigIntf* origIntf)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,8 @@ namespace DDraw
|
|||||||
while (SUCCEEDED(surface->GetAttachedSurface(surface, &caps, &nextSurface.getRef())) &&
|
while (SUCCEEDED(surface->GetAttachedSurface(surface, &caps, &nextSurface.getRef())) &&
|
||||||
nextSurface != g_primarySurface)
|
nextSurface != g_primarySurface)
|
||||||
{
|
{
|
||||||
surface = nextSurface;
|
surface.swap(nextSurface);
|
||||||
|
nextSurface.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user