From cdf4ca361264bf9618235947020eb3ada336f37c Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 25 Apr 2021 14:52:49 +0800 Subject: [PATCH] fix wrong implementation of search_win_tree_bfs --- src/gui/window.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/window.c b/src/gui/window.c index 7dd5b4a6..0a3db60b 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -3039,11 +3039,6 @@ static PMAINWIN search_win_tree_dfs (struct _search_context *ctxt) while (hosted) { PMAINWIN found; - ctxt->hosting = hosted; - if ((found = search_win_tree_dfs (ctxt))) { - return found; - } - if (hosted->id == ctxt->id && (((ctxt->flags & WIN_SEARCH_FILTER_MAIN) && hosted->WinType == TYPE_MAINWIN) || @@ -3052,6 +3047,11 @@ static PMAINWIN search_win_tree_dfs (struct _search_context *ctxt) return hosted; } + ctxt->hosting = hosted; + if ((found = search_win_tree_dfs (ctxt))) { + return found; + } + hosted = GetNextHosted (hosting, hosted); } @@ -3074,12 +3074,13 @@ static PMAINWIN search_win_tree_bfs (struct _search_context *ctxt) return hosted; } - ctxt->hosting = hosted; - if ((found = search_win_tree_bfs (ctxt))) { - return found; + if ((ctxt->hosting = GetNextHosted (hosting, hosted))) { + if ((found = search_win_tree_bfs (ctxt))) { + return found; + } } - hosted = GetNextHosted (hosting, hosted); + hosted = GetFirstHosted (hosted); } return NULL;