pulse-server: add operation_free_by_tag()

This commit is contained in:
Barnabás Pőcze 2023-05-07 16:16:20 +02:00 committed by Wim Taymans
parent dd5f0e6bea
commit 0395424461
2 changed files with 8 additions and 3 deletions

View file

@ -27,4 +27,11 @@ struct operation *operation_find(struct client *client, uint32_t tag);
void operation_free(struct operation *o); void operation_free(struct operation *o);
void operation_complete(struct operation *o); void operation_complete(struct operation *o);
static inline void operation_free_by_tag(struct client *client, uint32_t tag)
{
struct operation *o = operation_find(client, tag);
if (o)
operation_free(o);
}
#endif /* PULSER_SERVER_OPERATION_H */ #endif /* PULSER_SERVER_OPERATION_H */

View file

@ -110,14 +110,12 @@ void pending_sample_free(struct pending_sample *ps)
{ {
struct client * const client = ps->client; struct client * const client = ps->client;
struct impl * const impl = client->impl; struct impl * const impl = client->impl;
struct operation *o;
spa_list_remove(&ps->link); spa_list_remove(&ps->link);
spa_hook_remove(&ps->listener); spa_hook_remove(&ps->listener);
pw_work_queue_cancel(impl->work_queue, ps, SPA_ID_INVALID); pw_work_queue_cancel(impl->work_queue, ps, SPA_ID_INVALID);
if ((o = operation_find(client, ps->tag)) != NULL) operation_free_by_tag(client, ps->tag);
operation_free(o);
sample_play_destroy(ps->play); sample_play_destroy(ps->play);
} }