[PATCH v3 0/2] MR8804: server: Return NULL from get_first_valid_hook when no hook is found.
Fixes: 5b7b76432dffa453e75c6336d76fdb856ab8d0c7 -- v3: https://gitlab.winehq.org/wine/wine/-/merge_requests/8804
From: Rémi Bernon <rbernon(a)codeweavers.com> Fixes: 5b7b76432dffa453e75c6336d76fdb856ab8d0c7 --- server/hook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/hook.c b/server/hook.c index e0281d92b81..688174baab5 100644 --- a/server/hook.c +++ b/server/hook.c @@ -257,7 +257,7 @@ static inline struct hook *get_first_valid_hook( struct hook_table *table, int i } } } - return hook; + return NULL; } /* find the next hook in the chain, skipping the deleted ones */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8804
From: Rémi Bernon <rbernon(a)codeweavers.com> Fixes: 5b7b76432dffa453e75c6336d76fdb856ab8d0c7 --- server/hook.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/hook.c b/server/hook.c index 688174baab5..d04b784b0b3 100644 --- a/server/hook.c +++ b/server/hook.c @@ -285,12 +285,9 @@ static struct hook *get_next_hook( struct thread *thread, struct hook *hook, int } } } - global_hooks = get_global_hooks( thread ); - if (global_hooks && table != global_hooks) /* now search through the global table */ - { - hook = get_first_valid_hook( global_hooks, index, event, win, object_id, child_id ); - } - return hook; + + if (!(global_hooks = get_global_hooks( thread )) || table == global_hooks) return NULL; + return get_first_valid_hook( global_hooks, index, event, win, object_id, child_id ); } static void hook_table_dump( struct object *obj, int verbose ) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8804
Yeah, we should not be using LIST_FOR_EACH_ENTRY there as we want to continue the iteration. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8804#note_113421
This merge request was closed by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8804
participants (1)
-
Rémi Bernon