Module: vkd3d
Branch: master
Commit: 3d49b59a68687cf32ee489c22d133c9f758a37c6
URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/3d49b59a68687cf32ee489c22d133…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com>
Date: Tue Jul 25 15:14:36 2023 +1000
vkd3d: Handle the case where a descriptor is null and is concurrently written non-null.
If view is null and the comparison (view == src->s.u.object) is false,
vkd3d_view_decref will be called on null.
---
libs/vkd3d/vkd3d_private.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 3be12be7..a5eed59a 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -882,8 +882,9 @@ static inline void *d3d12_desc_get_object_ref(const volatile struct d3d12_desc *
{
do
{
- view = src->s.u.object;
- } while (view && !vkd3d_view_incref(view));
+ if (!(view = src->s.u.object))
+ return NULL;
+ } while (!vkd3d_view_incref(view));
/* Check if the object is still in src to handle the case where it was
* already freed and reused elsewhere when the refcount was incremented. */