Ensure we AddRef when returning an existing ID3DDeviceContextState

* Fixes a crash with Firefox and other D2D using applications.
This commit is contained in:
baldurk
2018-05-01 14:47:01 +01:00
parent f339314468
commit e51466efe1
@@ -1994,9 +1994,15 @@ void WrappedID3D11DeviceContext::SwapDeviceContextState(ID3DDeviceContextState *
WrappedID3DDeviceContextState *wrapped = NULL;
if(m_pDevice->GetResourceManager()->HasWrapper(prev))
{
wrapped = (WrappedID3DDeviceContextState *)m_pDevice->GetResourceManager()->GetWrapper(prev);
wrapped->AddRef();
}
else if(prev)
{
wrapped = new WrappedID3DDeviceContextState(prev, m_pDevice);
}
if(wrapped)
wrapped->state->CopyState(*m_CurrentPipelineState);