Skip to content

Commit ca15a65

Browse files
fix for occasional crash related to thera updates during a refresh
1 parent a58f759 commit ca15a65

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

SMT/RegionControl.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,9 @@ public void AddTheraSystemsToMap()
438438
{
439439
Brush TheraBrush = new SolidColorBrush(MapConf.ActiveColourScheme.TheraEntranceSystem);
440440

441-
foreach (TheraConnection tc in EM.TheraConnections)
441+
List<TheraConnection> currentTheraConnections = EM.TheraConnections.ToList();
442+
443+
foreach (TheraConnection tc in currentTheraConnections)
442444
{
443445
if (Region.IsSystemOnMap(tc.System))
444446
{
@@ -3693,8 +3695,9 @@ private void ShapeMouseOverHandler(object sender, MouseEventArgs e)
36933695
SystemInfoPopupSP.Children.Add(sov);
36943696
}
36953697

3698+
List<TheraConnection> currentTheraConnections = EM.TheraConnections.ToList();
36963699
// update Thera Info
3697-
foreach (EVEData.TheraConnection tc in EM.TheraConnections)
3700+
foreach (EVEData.TheraConnection tc in currentTheraConnections)
36983701
{
36993702
if (selectedSys.Name == tc.System)
37003703
{

SMT/RegionsViewControl.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Windows.Input;
77
using System.Windows.Media;
88
using System.Windows.Shapes;
9+
using SMT.EVEData;
910

1011
namespace SMT
1112
{
@@ -217,7 +218,8 @@ private void RegionThera_ShapeMouseOverHandler(object sender, MouseEventArgs e)
217218
header.Padding = new Thickness(1);
218219
RegionTheraInfoSP.Children.Add(header);
219220

220-
foreach (EVEData.TheraConnection tc in EVEData.EveManager.Instance.TheraConnections)
221+
List<TheraConnection> currentTheraConnections = EVEData.EveManager.Instance.TheraConnections.ToList();
222+
foreach (EVEData.TheraConnection tc in currentTheraConnections)
221223
{
222224
if (string.Compare(tc.Region, selectedRegion.Name, true) == 0)
223225
{
@@ -247,10 +249,12 @@ private void AddDataToUniverse()
247249
Brush theraBrush = new SolidColorBrush(MapConf.ActiveColourScheme.TheraEntranceRegion);
248250
Brush characterBrush = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterHighlightColour);
249251

252+
List<TheraConnection> currentTheraConnections = EVEData.EveManager.Instance.TheraConnections.ToList();
253+
250254
foreach (EVEData.MapRegion mr in EVEData.EveManager.Instance.Regions)
251255
{
252256
bool addTheraConnection = false;
253-
foreach (EVEData.TheraConnection tc in EVEData.EveManager.Instance.TheraConnections)
257+
foreach (EVEData.TheraConnection tc in currentTheraConnections)
254258
{
255259
if (string.Compare(tc.Region, mr.Name, true) == 0)
256260
{

0 commit comments

Comments
 (0)