frame-xchg: Fix frame_watch_remove_by_handler for group 0

Don't match the default group's (group_id 0) wdev_id against the
provided wdev_id because the default group can be used on all wdevs and
its wdev_id is 0.  Also match individual item's wdev_id in the group to
make up for this although it normally wouldn't matter.
This commit is contained in:
Andrew Zaborowski 2020-05-31 02:56:44 +02:00 committed by Denis Kenzior
parent cc66050b90
commit d012a7f2ac
1 changed files with 5 additions and 3 deletions

View File

@ -661,6 +661,7 @@ bool frame_watch_wdev_remove(uint64_t wdev_id)
}
struct frame_watch_handler_check_info {
uint64_t wdev_id;
frame_watch_cb_t handler;
void *user_data;
};
@ -671,7 +672,8 @@ static bool frame_watch_item_remove_by_handler(void *data, void *user_data)
l_container_of(data, struct frame_watch, super);
struct frame_watch_handler_check_info *info = user_data;
if (watch->super.notify != info->handler ||
if (watch->wdev_id != info->wdev_id ||
watch->super.notify != info->handler ||
watch->super.notify_data != info->user_data)
return false;
@ -702,9 +704,9 @@ static bool frame_watch_remove_by_handler(uint64_t wdev_id, uint32_t group_id,
void *user_data)
{
struct watch_group_match_info group_info =
{ wdev_id, group_id };
{ group_id == 0 ? 0 : wdev_id, group_id };
struct frame_watch_handler_check_info handler_info =
{ handler, user_data };
{ wdev_id, handler, user_data };
struct watch_group *group = l_queue_find(watch_groups,
frame_watch_group_match,
&group_info);