Skip to content

Commit

Permalink
Fix crash in "AddressLookupTable" destructor due to invalid cast
Browse files Browse the repository at this point in the history
  • Loading branch information
crosire committed Jul 14, 2017
1 parent 0d3ec0a commit 970135f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions source/d3d8to9.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Direct3DDevice8 : public IUnknown
DWORD CurrentVertexShaderHandle = 0, CurrentPixelShaderHandle = 0;
};

class Direct3DSwapChain8 : public IUnknown, private AddressLookupTableObject
class Direct3DSwapChain8 : public IUnknown, public AddressLookupTableObject
{
Direct3DSwapChain8(const Direct3DSwapChain8 &) = delete;
Direct3DSwapChain8 &operator=(const Direct3DSwapChain8 &) = delete;
Expand Down Expand Up @@ -223,7 +223,7 @@ class Direct3DBaseTexture8 : public Direct3DResource8
virtual DWORD STDMETHODCALLTYPE GetLOD() = 0;
virtual DWORD STDMETHODCALLTYPE GetLevelCount() = 0;
};
class Direct3DTexture8 : public Direct3DBaseTexture8, private AddressLookupTableObject
class Direct3DTexture8 : public Direct3DBaseTexture8, public AddressLookupTableObject
{
Direct3DTexture8(const Direct3DTexture8 &) = delete;
Direct3DTexture8 &operator=(const Direct3DTexture8 &) = delete;
Expand Down Expand Up @@ -261,7 +261,7 @@ class Direct3DTexture8 : public Direct3DBaseTexture8, private AddressLookupTable
Direct3DDevice8 *const Device;
IDirect3DTexture9 *const ProxyInterface;
};
class Direct3DCubeTexture8 : public Direct3DBaseTexture8, private AddressLookupTableObject
class Direct3DCubeTexture8 : public Direct3DBaseTexture8, public AddressLookupTableObject
{
Direct3DCubeTexture8(const Direct3DCubeTexture8 &) = delete;
Direct3DCubeTexture8 &operator=(const Direct3DCubeTexture8 &) = delete;
Expand Down Expand Up @@ -299,7 +299,7 @@ class Direct3DCubeTexture8 : public Direct3DBaseTexture8, private AddressLookupT
Direct3DDevice8 *const Device;
IDirect3DCubeTexture9 *const ProxyInterface;
};
class Direct3DVolumeTexture8 : public Direct3DBaseTexture8, private AddressLookupTableObject
class Direct3DVolumeTexture8 : public Direct3DBaseTexture8, public AddressLookupTableObject
{
Direct3DVolumeTexture8(const Direct3DVolumeTexture8 &) = delete;
Direct3DVolumeTexture8 &operator=(const Direct3DVolumeTexture8 &) = delete;
Expand Down Expand Up @@ -338,7 +338,7 @@ class Direct3DVolumeTexture8 : public Direct3DBaseTexture8, private AddressLooku
IDirect3DVolumeTexture9 *const ProxyInterface;
};

class Direct3DSurface8 : public IUnknown, private AddressLookupTableObject
class Direct3DSurface8 : public IUnknown, public AddressLookupTableObject
{
Direct3DSurface8(const Direct3DSurface8 &) = delete;
Direct3DSurface8 &operator=(const Direct3DSurface8 &) = delete;
Expand Down Expand Up @@ -367,7 +367,7 @@ class Direct3DSurface8 : public IUnknown, private AddressLookupTableObject
IDirect3DSurface9 *const ProxyInterface;
};

class Direct3DVolume8 : public IUnknown, private AddressLookupTableObject
class Direct3DVolume8 : public IUnknown, public AddressLookupTableObject
{
Direct3DVolume8(const Direct3DVolume8 &) = delete;
Direct3DVolume8 &operator=(const Direct3DVolume8 &) = delete;
Expand Down Expand Up @@ -396,7 +396,7 @@ class Direct3DVolume8 : public IUnknown, private AddressLookupTableObject
IDirect3DVolume9 *const ProxyInterface;
};

class Direct3DVertexBuffer8 : public Direct3DResource8, private AddressLookupTableObject
class Direct3DVertexBuffer8 : public Direct3DResource8, public AddressLookupTableObject
{
Direct3DVertexBuffer8(const Direct3DVertexBuffer8 &) = delete;
Direct3DVertexBuffer8 &operator=(const Direct3DVertexBuffer8 &) = delete;
Expand Down Expand Up @@ -429,7 +429,7 @@ class Direct3DVertexBuffer8 : public Direct3DResource8, private AddressLookupTab
IDirect3DVertexBuffer9 *const ProxyInterface;
};

class Direct3DIndexBuffer8 : public Direct3DResource8, private AddressLookupTableObject
class Direct3DIndexBuffer8 : public Direct3DResource8, public AddressLookupTableObject
{
Direct3DIndexBuffer8(const Direct3DIndexBuffer8 &) = delete;
Direct3DIndexBuffer8 &operator=(const Direct3DIndexBuffer8 &) = delete;
Expand Down
2 changes: 1 addition & 1 deletion source/lookup_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ AddressLookupTable::~AddressLookupTable()
{
assert(AddressCache[i].back().Address8 != nullptr);

static_cast<AddressLookupTableObject *>(AddressCache[i].back().Address8)->DeleteMe(false);
AddressCache[i].back().Address8->DeleteMe(false);

AddressCache[i].pop_back();
}
Expand Down
2 changes: 1 addition & 1 deletion source/lookup_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AddressLookupTable
{
struct AddressStruct
{
void *Address8 = nullptr;
class AddressLookupTableObject *Address8 = nullptr;
void *Address9 = nullptr;
};

Expand Down

0 comments on commit 970135f

Please sign in to comment.