Commit 362984de authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

picture_pool: fix cancellation handling with lock

If there is a deprecated lock callback, the mutex might be released
and the cancellation flag much be rechecked.

Conversely, if the pool is empty, then there is no point in checking
the flag: allocation will anyway fail immediately.
parent 09fa6281
......@@ -209,16 +209,13 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
assert(pool->refs > 0);
available = pool->available;
if (pool->canceled)
{
vlc_mutex_unlock(&pool->lock);
return NULL;
}
while (available != 0)
{
int i = ctz(available);
if (unlikely(pool->canceled))
break;
pool->available &= ~(1ULL << i);
vlc_mutex_unlock(&pool->lock);
available &= ~(1ULL << i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment