Ok. Here's the situation. So I'm creating units and I need to attach "RegisterUnitInRange" events dynamically to these units. So I'm using a snippet from here to accomplish that.
That part is simple. These created units are removed after sometime. So I think to myself, I should probably unregister the events before removing the units from the map.
But I remembered that destroying dynamic triggers can sometime cause handle corruption which can lead to fatals etc. And UnregisterUnitInRangeEvent in the above snippet does utilize destroytrigger for cleaning up purposes.
So how should I handle this situation? do I:
That part is simple. These created units are removed after sometime. So I think to myself, I should probably unregister the events before removing the units from the map.
But I remembered that destroying dynamic triggers can sometime cause handle corruption which can lead to fatals etc. And UnregisterUnitInRangeEvent in the above snippet does utilize destroytrigger for cleaning up purposes.
So how should I handle this situation? do I:
- Let the triggers leak?
- Unregister the event anyway?