mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-30 14:50:44 +02:00
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 <davyaxel0@gmail.com> Acked-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9177>
This commit is contained in:
parent
d730f8d7a9
commit
7a1a1fc5d9
1 changed files with 6 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue