thread: avoid calling destructor twice