ULONG r = p_atomic_dec_return(&This->refs);
if (r == 0) {
+ struct NineDevice9 *device = This->device;
/* 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));
+ if (device) {
+ NineUnknown_Release(NineUnknown(device));
}
}
return r;
ULONG r = p_atomic_dec_return(&This->refs);
if (r == 0) {
+ struct NineDevice9 *device = This->device;
/* 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));
+ if (device) {
+ NineUnknown_ReleaseWithDtorLock(NineUnknown(device));
}
}
return r;