Module: Mesa Branch: master Commit: 7a1a1fc5d931e2b853c3f28aa763fb54de93eca2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a1a1fc5d931e2b853c3f28aa763fb54de93eca2
Author: Axel Davy <[email protected]> Date: Mon Feb 8 23:33:29 2021 +0100 st/nine: Fix leak at device destruction At the release of the last object holding a reference on the device, the device dtor was executed and the objector dtor was ignored. The proper way is to execute the object dtor, then the device dtor. The previous code was likely for a workaround against something that was fixed since. Signed-off-by: Axel Davy <[email protected]> Acked-by: Timur Kristóf <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9177> --- src/gallium/frontends/nine/iunknown.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gallium/frontends/nine/iunknown.c b/src/gallium/frontends/nine/iunknown.c index c3d4f5d41d3..2f3286a2308 100644 --- a/src/gallium/frontends/nine/iunknown.c +++ b/src/gallium/frontends/nine/iunknown.c @@ -134,14 +134,13 @@ NineUnknown_Release( struct NineUnknown *This ) ULONG r = p_atomic_dec_return(&This->refs); if (r == 0) { - if (This->device) { - if (NineUnknown_Release(NineUnknown(This->device)) == 0) - return r; /* everything's gone */ - } /* Containers (here with !forward) take care of item destruction */ if (!This->container && This->bind == 0) { This->dtor(This); } + if (This->device) { + NineUnknown_Release(NineUnknown(This->device)); + } } return r; } @@ -157,16 +156,15 @@ NineUnknown_ReleaseWithDtorLock( struct NineUnknown *This ) ULONG r = p_atomic_dec_return(&This->refs); if (r == 0) { - if (This->device) { - if (NineUnknown_ReleaseWithDtorLock(NineUnknown(This->device)) == 0) - return r; /* everything's gone */ - } /* Containers (here with !forward) take care of item destruction */ if (!This->container && This->bind == 0) { NineLockGlobalMutex(); This->dtor(This); NineUnlockGlobalMutex(); } + if (This->device) { + NineUnknown_ReleaseWithDtorLock(NineUnknown(This->device)); + } } return r; } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
