Skip to content

Commit

Permalink
[util,d3d11] Be more robust against use-after-free
Browse files Browse the repository at this point in the history
Sims 4 binds an SRV after destroying it, so we need to ensure our internal
view pointers are null or we'll create a problem otherwise.
  • Loading branch information
doitsujin committed Sep 2, 2024
1 parent 04d558c commit 427e706
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/d3d11/d3d11_view_dsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ namespace dxvk {

D3D11DepthStencilView::~D3D11DepthStencilView() {
ResourceReleasePrivate(m_resource);
m_resource = nullptr;
}


Expand Down
1 change: 1 addition & 0 deletions src/d3d11/d3d11_view_rtv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace dxvk {

D3D11RenderTargetView::~D3D11RenderTargetView() {
ResourceReleasePrivate(m_resource);
m_resource = nullptr;
}


Expand Down
1 change: 1 addition & 0 deletions src/d3d11/d3d11_view_srv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ namespace dxvk {

D3D11ShaderResourceView::~D3D11ShaderResourceView() {
ResourceReleasePrivate(m_resource);
m_resource = nullptr;
}


Expand Down
1 change: 1 addition & 0 deletions src/d3d11/d3d11_view_uav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace dxvk {

D3D11UnorderedAccessView::~D3D11UnorderedAccessView() {
ResourceReleasePrivate(m_resource);
m_resource = nullptr;
}


Expand Down
1 change: 1 addition & 0 deletions src/util/com/com_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ namespace dxvk {

~Com() {
this->decRef();
m_ptr = nullptr;
}

T* operator -> () const {
Expand Down
1 change: 1 addition & 0 deletions src/util/rc/util_rc_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace dxvk {

~Rc() {
this->decRef();
m_object = nullptr;
}

T& operator * () const { return *m_object; }
Expand Down

0 comments on commit 427e706

Please sign in to comment.