orbitusii / loki-bms-csharp

Battle Management Scope for DCS World (and maybe others?), this time in C#!
MIT License
2 stars 0 forks source link

Bug - LOKI crashes when database updated and trying to render #32

Closed orbitusii closed 8 months ago

orbitusii commented 11 months ago

Basically, race conditions suck. Occurs infrequently, but most often while combat is taking place and tracks are getting destroyed/timed out. Root cause: the Database updates itself and removes a dropped track while the scope is trying to render.

This might be fixed with some filtering that creates a separate list of tracks/data/TEs or a proper lock condition on the track, data, and TE collections.

At least right now, it seems prudent to hide the tracks and data and stuff behind a GetData() method instead of letting the renderer retrieve it by simple object reference. That would make it possible to pass a cloned list that won't be manipulated by the database as it's updating... Or I can just leave the lock() statements in place. We'll see what works better.

orbitusii commented 8 months ago

Looks like this is notionally fixed with the tagged commit, gonna do some more testing today then we'll see.