pipewire-v4l2: increase reference count atomically

The reference count increment in `add_fd_map()` (called from `v4l2_dup()`)
may run at the same time as `unref_file()` (called from `v4l2_close()`).
Atomically increase the refcnt to avoid any problems.
This commit is contained in:
Barnabás Pőcze 2021-10-14 21:05:53 +02:00 committed by Wim Taymans
parent d21a8caace
commit 170f31dedc

View File

@ -294,7 +294,7 @@ static int add_fd_map(int fd, struct file *file)
if (map != NULL) {
map->fd = fd;
map->file = file;
file->ref++;
ATOMIC_INC(file->ref);
}
pthread_mutex_unlock(&globals.lock);
return 0;