From 3c884ed9bb35943dd8df89249c04dd9eb3b14045 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 19:06:32 +0000 Subject: [PATCH] GameSpy: Fix race condition in RefreshGameList --- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 3833d1c696a..5ef54a24a7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -1066,17 +1066,10 @@ void RefreshGameListBox( GameWindow *win, Bool showMap ) } */ - clearBuddyGames(); - - // restore selection - GadgetListBoxSetSelected(win, indexToSelect); // even for -1, so we can disable the 'Join Game' button -// if(prevPos > 10) - GadgetListBoxSetTopVisibleEntry( win, prevPos );//+ 1 - - if (indexToSelect < 0 && selectedID) - { - TheWindowManager->winSetLoneWindow(NULL); - } + // Note: clearBuddyGames(), GadgetListBoxSetSelected(), and GadgetListBoxSetTopVisibleEntry() + // are now handled inside the SearchForLobbies callback above (after async operation completes). + // The code below was removed to fix a race condition where these operations executed on the + // empty/reset listbox before the async callback populated it, causing crashes. } void RefreshGameInfoListBox( GameWindow *mainWin, GameWindow *win )