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

Fixed resetting of the compatible primary surface pointers on release

The internal surface pointers to the compatible primary surface were not being reset
when the surface was released, possibly leading to other surfaces being misidentified
as the compatible primary surface.

All internal primary surface pointers are now reset to null on release.
This commit is contained in:
narzoul 2015-12-28 21:04:51 +01:00
parent 9461e7357c
commit 6b6d161190
3 changed files with 14 additions and 0 deletions

View File

@ -360,6 +360,12 @@ void CompatDirectDrawSurface<TSurface>::initPrimarySurfacePtr(const GUID& guid,
}
}
template <typename TSurface>
void CompatDirectDrawSurface<TSurface>::resetPrimarySurfacePtr()
{
s_compatPrimarySurface = nullptr;
}
template <typename TSurface>
HRESULT STDMETHODCALLTYPE CompatDirectDrawSurface<TSurface>::Blt(
TSurface* This,

View File

@ -22,6 +22,7 @@ public:
static void fixSurfacePtrs(TSurface& surface);
static void initPrimarySurfacePtr(const GUID& guid, IUnknown& surface);
static void resetPrimarySurfacePtr();
static void updateSurfaceParams();
static HRESULT STDMETHODCALLTYPE Blt(

View File

@ -1,4 +1,5 @@
#include "CompatDirectDraw.h"
#include "CompatDirectDrawSurface.h"
#include "CompatPrimarySurface.h"
#include "IReleaseNotifier.h"
#include "RealPrimarySurface.h"
@ -15,6 +16,12 @@ namespace
CompatPrimarySurface::pitch = 0;
CompatPrimarySurface::surfacePtr = nullptr;
CompatDirectDrawSurface<IDirectDrawSurface>::resetPrimarySurfacePtr();
CompatDirectDrawSurface<IDirectDrawSurface2>::resetPrimarySurfacePtr();
CompatDirectDrawSurface<IDirectDrawSurface3>::resetPrimarySurfacePtr();
CompatDirectDrawSurface<IDirectDrawSurface4>::resetPrimarySurfacePtr();
CompatDirectDrawSurface<IDirectDrawSurface7>::resetPrimarySurfacePtr();
RealPrimarySurface::release();
}
}