[PATCH 2/6] wined3d: Reference-count the wined3d_device_context structure.

Zebediah Figura (she/her) zfigura at codeweavers.com
Mon Mar 8 09:56:10 CST 2021


On 3/8/21 5:29 AM, Henri Verbeet wrote:
> On Sun, 7 Mar 2021 at 23:19, Zebediah Figura <z.figura12 at gmail.com> wrote:
>> @@ -2058,6 +2082,7 @@ struct wined3d_device_context * CDECL wined3d_device_get_immediate_context(struc
>>  {
>>      TRACE("device %p.\n", device);
>>
>> +    wined3d_device_context_incref(&device->cs->c);
>>      return &device->cs->c;
>>  }
> That's inconsistent with the rest of the API. As a rule we don't
> increment reference counts when returning objects, leaving that to the
> caller instead if necessary. (And more often than not, it isn't.)
> 
> It may also be worth mentioning why device contexts need to be
> reference counted at all. I assume there's a reason, but it's not
> obvious to me from this series.
> 

Mostly because it's then easy to always decref from
ID3D11DeviceContext::Release(), though it could certainly be considered
easier to check the context type there.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210308/f3bce387/attachment.sig>


More information about the wine-devel mailing list