On 14 March 2014 14:50, Stefan Dösinger stefan@codeweavers.com wrote:
- if ((old = wined3d_private_store_get_private_data(store, guid)) && old->size == data_size)
- {
IUnknown *release = NULL;
if (old->flags & WINED3DSPD_IUNKNOWN)
release = old->content.object;
memcpy(old->content.data, ptr, data_size);
old->flags = flags;
if (flags & WINED3DSPD_IUNKNOWN)
IUnknown_AddRef(old->content.object);
if (release)
IUnknown_Release(release);
return WINED3D_OK;
- }
What is the motivation for this? It certainly doesn't make the code any prettier.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2014-03-14 16:27, schrieb Henri Verbeet:
On 14 March 2014 14:50, Stefan Dösinger stefan@codeweavers.com wrote:
- if ((old = wined3d_private_store_get_private_data(store, guid)) && old->size == data_size)
- {
IUnknown *release = NULL;
if (old->flags & WINED3DSPD_IUNKNOWN)
release = old->content.object;
memcpy(old->content.data, ptr, data_size);
old->flags = flags;
if (flags & WINED3DSPD_IUNKNOWN)
IUnknown_AddRef(old->content.object);
if (release)
IUnknown_Release(release);
return WINED3D_OK;
- }
What is the motivation for this? It certainly doesn't make the code any prettier.
Avoid re-allocating the same sized object needlessly. But I don't feel strongly about it.
I'll send a separate patch that fixes the release before addref problem without retaining the allocated memory. Pick whichever you like.