Changeset - r25433:2354652aa0d6
[Not reviewed]
master
0 2 0
Patric Stout - 4 years ago 2021-05-11 10:32:27
truebrain@openttd.org
Fix: [Network] don't rebuild the host-list during iterating the list (#9240)

Additionally, only rebuild it when we added a new manual server,
as otherwise it is a noop anyway.
2 files changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/network/network.cpp
Show inline comments
 
@@ -698,13 +698,12 @@ NetworkGameList *NetworkAddServer(const 
 
	/* Ensure the item already exists in the list */
 
	NetworkGameList *item = NetworkGameListAddItem(connection_string);
 
	if (item->info.server_name.empty()) {
 
		ClearGRFConfigList(&item->info.grfconfig);
 
		item->info.server_name = connection_string;
 

	
 
		NetworkRebuildHostList();
 
		UpdateNetworkGameWindow();
 

	
 
		NetworkQueryServer(connection_string);
 
	}
 

	
 
	if (manually) item->manually = true;
src/network/network_gui.cpp
Show inline comments
 
@@ -827,12 +827,13 @@ public:
 

	
 
	void OnQueryTextFinished(char *str) override
 
	{
 
		if (!StrEmpty(str)) {
 
			strecpy(_settings_client.network.connect_to_ip, str, lastof(_settings_client.network.connect_to_ip));
 
			NetworkAddServer(str);
 
			NetworkRebuildHostList();
 
		}
 
	}
 

	
 
	void OnResize() override
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, WID_NG_MATRIX);
0 comments (0 inline, 0 general)