The member TransferPool::pending_transfer_ is actually shared among the EventLoop and the thread calling Freenect2DeviceImpl::stop. Hence, it needs to be mutex protected in order to avoid the program crashes or hungs up on exit. A simple workaround is to wait a little (2 secs) between disableSubmission and cancel in the method Freenect2DeviceImpl::stop