mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-07 00:20:09 +00:00
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:
parent
d21a8caace
commit
170f31dedc
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue