wined3d: Don't modify existing data if set_private_data fails.
This commit is contained in:
parent
9277fcfdb4
commit
ab6368b6e8
|
@ -211,7 +211,11 @@ HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resourc
|
|||
TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n",
|
||||
resource, debugstr_guid(guid), data, data_size, flags);
|
||||
|
||||
wined3d_resource_free_private_data(resource, guid);
|
||||
if (flags & WINED3DSPD_IUNKNOWN && data_size != sizeof(IUnknown *))
|
||||
{
|
||||
WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d));
|
||||
if (!d) return E_OUTOFMEMORY;
|
||||
|
@ -221,12 +225,6 @@ HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resourc
|
|||
|
||||
if (flags & WINED3DSPD_IUNKNOWN)
|
||||
{
|
||||
if (data_size != sizeof(IUnknown *))
|
||||
{
|
||||
WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size);
|
||||
HeapFree(GetProcessHeap(), 0, d);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
d->ptr.object = (IUnknown *)data;
|
||||
d->size = sizeof(IUnknown *);
|
||||
IUnknown_AddRef(d->ptr.object);
|
||||
|
@ -242,6 +240,7 @@ HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resourc
|
|||
d->size = data_size;
|
||||
memcpy(d->ptr.data, data, data_size);
|
||||
}
|
||||
wined3d_resource_free_private_data(resource, guid);
|
||||
list_add_tail(&resource->privateData, &d->entry);
|
||||
|
||||
return WINED3D_OK;
|
||||
|
|
Loading…
Reference in New Issue