MOARdV / AvionicsSystems

MOARdV's Avionics Systems for Kerbal Space Program - a new generation of IVA enhancement.
Other
52 stars 26 forks source link

Better handling of coroutine stops #270

Closed MOARdV closed 5 years ago

MOARdV commented 5 years ago

It looks like I may be able to trigger exceptions if MAS is shut down while co-routines are running. There is a method to stop co-routines, but it requires a little bit of change to use it.

 Coroutine co;

 // start the coroutine the usual way but store the Coroutine object that StartCoroutine returns.
 co = StartCoroutine(MyCoroutine());
 StopCoroutine(co); // stop the coroutine

I've got a number of places where I will kick off a coroutine and let it run until it decides it's done. Those places need to keep coroutine references handy so they can specifically kill the coroutine if the parent object is getting torn down.