Skip to content

Commit

Permalink
Fix OpenTTD#9269, f6d5c01: Skip invalid windows when checking z-priority
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 committed May 15, 2021
1 parent fab120e commit fa89a70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/window.cpp
Expand Up @@ -1351,7 +1351,8 @@ static void BringWindowToFront(Window *w, bool dirty)
{
auto priority = GetWindowZPriority(w->window_class);
WindowList::iterator dest = _z_windows.begin();
while (dest != _z_windows.end() && (*dest == nullptr || GetWindowZPriority((*dest)->window_class) <= priority)) ++dest;
/* Dropdowns and Pickers use WC_INVALID to hide themselves until deletion. */
while (dest != _z_windows.end() && (*dest == nullptr || (*dest)->window_class == WC_INVALID || GetWindowZPriority((*dest)->window_class) <= priority)) ++dest;

if (dest != w->z_position) {
_z_windows.splice(dest, _z_windows, w->z_position);
Expand Down

0 comments on commit fa89a70

Please sign in to comment.