Because its auto-delete
, so the task destroy itself after work. And then, smart pointer going out of scope tries to delete something that has already been deleted.
You don’t need to manage(by smart pointer) a resource that manages itself(auto delete task).