We shouldn't detach until all children are surely destroyed. Found with: Coverity Prevent(tm) CID: 2137