On Tue Jun 6 20:04:05 2023 +0000, Connor McAdams wrote:
This could use some more work generally the more I think about it. In `uia_raise_event` I hold a reference to the `struct uia_event_map_entry`, which could be freed behind my back if someone called UiaRemoveEvent on the last event in the event list. Holding the critical section for the entirety of `uia_raise_event` sounded plausible, but that'd cause the event release to potentially hang if we hold the last event reference. I might add something like a reference count to the event map entry, not sure.
Having the list modified seems problematic as well. And you really don't want to call user code with a lock held if you can avoid it, but "user code" here may include getting the runtime id, navigating, and anything else you might need..
This is really tricky, and I have no good ideas at the moment.