Still the function could be called twice, right? So we do need to set the pointer to nullptr, otherwise you might get a double delete.