diff --git a/src/Task.cc b/src/Task.cc index 4bc6136309a..371131d1c74 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -2439,7 +2439,6 @@ Task* Task::clone(CloneReason reason, int flags, remote_ptr stack, bool ok = t->wait(); ASSERT(t, ok) << "Task " << t->tid << " killed unexpectedly; not sure how to handle this"; - t->post_wait_clone(this, flags); if (CLONE_SHARE_THREAD_GROUP & flags) { ASSERT(this, !new_tg); t->tg = tg; @@ -2452,6 +2451,8 @@ Task* Task::clone(CloneReason reason, int flags, remote_ptr stack, } t->tg->insert_task(t); + t->post_wait_clone(this, flags); + t->open_mem_fd_if_needed(); t->thread_areas_ = thread_areas_; if (CLONE_SET_TLS & flags) {