/* If we're forced to shut down, we might have to remove our
* reference to the last ref_elt being dumped.
*/
- if (ctx->state == STATE_LIST) {
+ if (!LIST_ISEMPTY(&ctx->bref.users)) {
HA_SPIN_LOCK(PATREF_LOCK, &ctx->ref->lock);
- if (!LIST_ISEMPTY(&ctx->bref.users)) {
- LIST_DELETE(&ctx->bref.users);
- LIST_INIT(&ctx->bref.users);
- }
+ LIST_DEL_INIT(&ctx->bref.users);
HA_SPIN_UNLOCK(PATREF_LOCK, &ctx->ref->lock);
}
return 1;
{
struct show_map_ctx *ctx = appctx->svcctx;
- if (ctx->state == STATE_LIST) {
+ if (!LIST_ISEMPTY(&ctx->bref.users)) {
HA_SPIN_LOCK(PATREF_LOCK, &ctx->ref->lock);
- if (!LIST_ISEMPTY(&ctx->bref.users))
- LIST_DELETE(&ctx->bref.users);
+ LIST_DEL_INIT(&ctx->bref.users);
HA_SPIN_UNLOCK(PATREF_LOCK, &ctx->ref->lock);
}
}