Skip to content

Commit 9ddc0bb

Browse files
authored
Don't free the apartment_context while we are still using it (#691)
1 parent 5869973 commit 9ddc0bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

strings/base_coroutine_threadpool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ WINRT_EXPORT namespace winrt
336336

337337
void await_suspend(std::experimental::coroutine_handle<> handle) const
338338
{
339-
impl::resume_apartment(context, handle);
339+
auto copy = context; // resuming may destruct *this, so use a copy
340+
impl::resume_apartment(copy, handle);
340341
}
341342

342343
impl::resume_apartment_context context;

0 commit comments

Comments
 (0)