ddraw: Check if the ddraw object still exists in d3d_device_inner_Release() (Valgrind).

This commit is contained in:
Henri Verbeet 2015-04-29 17:27:35 +02:00 committed by Alexandre Julliard
parent 4a416f8d37
commit 4c5276042d
2 changed files with 7 additions and 1 deletions

View File

@ -435,6 +435,9 @@ static void ddraw_destroy(struct ddraw *This)
wined3d_device_decref(This->wined3d_device);
wined3d_decref(This->wined3d);
if (This->d3ddevice)
This->d3ddevice->ddraw = NULL;
/* Now free the object */
HeapFree(GetProcessHeap(), 0, This);
}

View File

@ -316,7 +316,10 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
IUnknown_Release(rt_iface);
TRACE("Render target release done.\n");
This->ddraw->d3ddevice = NULL;
/* Releasing the render target above may have released the last
* reference to the ddraw object. */
if (This->ddraw)
This->ddraw->d3ddevice = NULL;
/* Now free the structure */
HeapFree(GetProcessHeap(), 0, This);