Fix checking for the deepest shown window in focus handling code

wxSetFocusToChild() could recurse to the parent TLW, which was clearly
nonsensical as it means that restoring last focus in a dialog could end
up setting it to the parent frame.

Fix this by breaking out of the loop as soon as we reach a TLW.

See #18653.
This commit is contained in:
Vadim Zeitlin
2020-01-20 00:32:21 +01:00
parent b9038a1e8c
commit 50a6e80be5

View File

@@ -711,6 +711,9 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
else
deepestVisibleWindow = NULL;
if ( (*childLastFocused)->IsTopLevel() )
break;
*childLastFocused = (*childLastFocused)->GetParent();
}