Why this crashes sometimes and other times spams is that wait_for_all() is sometimes called on a nullptr MirWaitHandle. The first thing that fn does is grab a lock. Some libc's seem smart enough to recognize that the memory isn't there and throw system_error, but its pretty conceivable that this could segfault if libc wasn't able to detect the memory issue and throw.
Why this crashes sometimes and other times spams is that wait_for_all() is sometimes called on a nullptr MirWaitHandle. The first thing that fn does is grab a lock. Some libc's seem smart enough to recognize that the memory isn't there and throw system_error, but its pretty conceivable that this could segfault if libc wasn't able to detect the memory issue and throw.