linux-capture: Fix map-like behavior for watcher
The original PR missed assigning the `idx` variable in unregister. When compiled without asserts this would silently not delete sources. Instead correctly assign idx and skip unregistration if the source doesnt appear registered. fixes #6532
This commit is contained in:
parent
cedc397b9f
commit
fb639e303c
@ -610,10 +610,13 @@ void watcher_unregister(xcb_connection_t *conn, struct xcompcap *s)
|
||||
sizeof(struct reg_item), &watcher_registry.da, i);
|
||||
|
||||
if (item->src == s) {
|
||||
idx = i;
|
||||
win = item->win;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx == DARRAY_INVALID)
|
||||
goto done;
|
||||
|
||||
da_erase(watcher_registry, idx);
|
||||
|
||||
@ -636,6 +639,7 @@ void watcher_unregister(xcb_connection_t *conn, struct xcompcap *s)
|
||||
vals);
|
||||
}
|
||||
|
||||
done:
|
||||
pthread_mutex_unlock(&watcher_lock);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user