Bug with lambda that was capturing by reference ( [&] ) when the calling function had detached its thread and was already out of scope. Fixed to capture by value