Commit 3ea66d60 authored by Rico Schüller's avatar Rico Schüller Committed by Alexandre Julliard

wined3d: Don't allow a negative lock_count in buffer_Unmap.

parent 9e5d07bb
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment