1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

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
2 changed files with 9 additions and 1 deletions

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();
}