support: also protect against recursive invocations

Add an extra private field to the source to store the pollevent of
the current iteration. This changes ABI but it seems an embedded source
is not used outside of our own plugins and the unit test doesn't test
this ABI case.

Whenever a source is removed, we can set the data field of the
pollevent to NULL so that it won't be handled in any iteration anymore.

Avoid dispatching the same event multiple times when doing recursive
iterations.

Add some more unit tests for this.

Fixes #2114
This commit is contained in:
Barnabás Pőcze 2022-02-08 17:21:10 +01:00 committed by Wim Taymans
parent 9acae229ab
commit bf886ba209
3 changed files with 151 additions and 16 deletions

View file

@ -66,6 +66,8 @@ struct spa_source {
int fd;
uint32_t mask;
uint32_t rmask;
/* private data for the loop implementer */
void *priv;
};
typedef int (*spa_invoke_func_t) (struct spa_loop *loop,