Fixed crash when setting a filter while the game is refreshing the server list
This commit is contained in:
@@ -29,20 +29,12 @@ namespace Barotrauma
|
|||||||
if (ComponentsToUpdate.Contains(this)) return;
|
if (ComponentsToUpdate.Contains(this)) return;
|
||||||
ComponentsToUpdate.Add(this);
|
ComponentsToUpdate.Add(this);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
||||||
foreach (GUIComponent c in fixedChildren)
|
foreach (GUIComponent c in fixedChildren)
|
||||||
{
|
{
|
||||||
c.AddToGUIUpdateList();
|
c.AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DebugConsole.NewMessage("Error in AddToGUIUPdateList! GUIComponent runtime type: "+this.GetType().ToString()+"; children count: "+children.Count.ToString(),Color.Red);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ClearUpdateList()
|
public static void ClearUpdateList()
|
||||||
{
|
{
|
||||||
@@ -438,8 +430,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//use a fixed list since children can change their order in the main children list
|
//use a fixed list since children can change their order in the main children list
|
||||||
//TODO: maybe find a more efficient way of handling changes in list order
|
//TODO: maybe find a more efficient way of handling changes in list order
|
||||||
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
||||||
@@ -449,12 +439,6 @@ namespace Barotrauma
|
|||||||
c.Update(deltaTime);
|
c.Update(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DebugConsole.NewMessage("Error in Update! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void SetDimensions(Point size, bool expandChildren = false)
|
public virtual void SetDimensions(Point size, bool expandChildren = false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -260,8 +260,6 @@ namespace Barotrauma
|
|||||||
if (ComponentsToUpdate.Contains(this)) return;
|
if (ComponentsToUpdate.Contains(this)) return;
|
||||||
ComponentsToUpdate.Add(this);
|
ComponentsToUpdate.Add(this);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
List<GUIComponent> fixedChildren = new List<GUIComponent>(children);
|
||||||
int lastVisible = 0;
|
int lastVisible = 0;
|
||||||
for (int i = 0; i < fixedChildren.Count; i++)
|
for (int i = 0; i < fixedChildren.Count; i++)
|
||||||
@@ -277,12 +275,6 @@ namespace Barotrauma
|
|||||||
lastVisible = i;
|
lastVisible = i;
|
||||||
fixedChildren[i].AddToGUIUpdateList();
|
fixedChildren[i].AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DebugConsole.NewMessage("Error in AddToGUIUpdateList! GUIComponent runtime type: " + this.GetType().ToString() + "; children count: " + children.Count.ToString(), Color.Red);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();
|
if (scrollBarEnabled && !scrollBarHidden) scrollBar.AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (GUIComponent child in serverList.children)
|
foreach (GUIComponent child in serverList.children)
|
||||||
{
|
{
|
||||||
|
if (!(child.UserData is ServerInfo)) continue;
|
||||||
ServerInfo serverInfo = (ServerInfo)child.UserData;
|
ServerInfo serverInfo = (ServerInfo)child.UserData;
|
||||||
|
|
||||||
child.Visible =
|
child.Visible =
|
||||||
|
|||||||
Reference in New Issue
Block a user