pw-dump: destroy all objects not just those matching the pattern

`registry_event_global()` creates an `object` object for every object,
not just those matching `data::pattern`. However, previously
`registry_event_global_remove()` only destroyed those objects
that matched the given pattern. Fix that by destroying
every object.

Fixes #4001
Fixes 47e1f38f03 ("pw-dump: also dump object removal")
This commit is contained in:
Barnabás Pőcze 2024-05-05 16:34:56 +02:00
parent 0c0d520c32
commit 6d7b0284dd

View file

@ -1395,20 +1395,20 @@ static void registry_event_global_remove(void *data, uint32_t id)
if ((o = find_object(d, id)) == NULL)
return;
d->state = STATE_FIRST;
if (d->pattern != NULL && !object_matches(o, d->pattern))
return;
if (d->state == STATE_FIRST)
put_begin(d, NULL, "[", 0);
put_begin(d, NULL, "{", 0);
put_int(d, "id", o->id);
if (o->class && o->class->dump)
put_value(d, "info", NULL);
else if (o->props)
put_value(d, "props", NULL);
put_end(d, "}", 0);
if (d->state != STATE_FIRST)
put_end(d, "]\n", 0);
if (!d->pattern || object_matches(o, d->pattern)) {
d->state = STATE_FIRST;
if (d->state == STATE_FIRST)
put_begin(d, NULL, "[", 0);
put_begin(d, NULL, "{", 0);
put_int(d, "id", o->id);
if (o->class && o->class->dump)
put_value(d, "info", NULL);
else if (o->props)
put_value(d, "props", NULL);
put_end(d, "}", 0);
if (d->state != STATE_FIRST)
put_end(d, "]\n", 0);
}
object_destroy(o);
}