Fix #14707: Crash when window is closed during text input

This commit is contained in:
ζeh Matt 2021-05-24 01:11:04 +03:00 committed by GitHub
parent 8d6b1c0da3
commit ebcdfd06e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -21,6 +21,7 @@
- Fix: [#14587] Confusing message when joining server with mismatched network version.
- Fix: [#14604] American-style Steam Trains are not imported correctly from RCT1 saves.
- Fix: [#14638] The “About OpenRCT2” window cannot be themed.
- Fix: [#14707] Crash when window is closed during text input.
- Fix: [#14710] Ride/Track Design preview does not show if it costs more money than available.
- Improved: [#14712]: Improve startup times.

View File

@ -408,6 +408,9 @@ void window_text_input_open(
void window_text_input_key(rct_window* w, char keychar)
{
const auto wndNumber = w->number;
const auto wndClass = w->classification;
// If the return button is pressed stop text input
if (keychar == '\r')
{
@ -417,5 +420,9 @@ void window_text_input_key(rct_window* w, char keychar)
textInputWindow->OnReturnPressed();
}
}
w->Invalidate();
// The window can be potentially closed within a callback, we need to check if its still alive.
w = window_find_by_number(wndClass, wndNumber);
if (w != nullptr)
w->Invalidate();
}