mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Don't allow a negative lock_count in buffer_Unmap.
This commit is contained in:
parent
9e5d07bb53
commit
3ea66d6026
1 changed files with 10 additions and 0 deletions
|
@ -985,6 +985,16 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* In the case that the number of Unmap calls > the
|
||||
* number of Map calls, d3d returns always D3D_OK.
|
||||
* This is also needed to prevent Map from returning garbage on
|
||||
* the next call (this will happen if the lock_count is < 0). */
|
||||
if(This->lock_count == 0)
|
||||
{
|
||||
TRACE("Unmap called without a previous Map call!\n");
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
if (InterlockedDecrement(&This->lock_count))
|
||||
{
|
||||
/* Delay loading the buffer until everything is unlocked */
|
||||
|
|
Loading…
Reference in a new issue