From d039d103af55c64f1b6d6737564035777b05e391 Mon Sep 17 00:00:00 2001 From: Sergey Chebotarev <50007587+d7d1cd@users.noreply.github.com> Date: Tue, 26 Aug 2025 10:29:23 +0000 Subject: [PATCH] fix accsess after destructor call --- .../coroutine2/detail/pull_control_block_cc.ipp | 12 ++++++------ .../coroutine2/detail/push_control_block_cc.ipp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/boost/coroutine2/detail/pull_control_block_cc.ipp b/include/boost/coroutine2/detail/pull_control_block_cc.ipp index f511e29..fd7d8ce 100644 --- a/include/boost/coroutine2/detail/pull_control_block_cc.ipp +++ b/include/boost/coroutine2/detail/pull_control_block_cc.ipp @@ -35,10 +35,10 @@ template< typename T > void pull_coroutine< T >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename T > @@ -191,10 +191,10 @@ template< typename T > void pull_coroutine< T & >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename T > @@ -324,10 +324,10 @@ inline void pull_coroutine< void >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename StackAllocator, typename Fn > diff --git a/include/boost/coroutine2/detail/push_control_block_cc.ipp b/include/boost/coroutine2/detail/push_control_block_cc.ipp index 695dc88..dbaaed2 100644 --- a/include/boost/coroutine2/detail/push_control_block_cc.ipp +++ b/include/boost/coroutine2/detail/push_control_block_cc.ipp @@ -34,10 +34,10 @@ template< typename T > void push_coroutine< T >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename T > @@ -165,10 +165,10 @@ template< typename T > void push_coroutine< T & >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename T > @@ -285,10 +285,10 @@ inline void push_coroutine< void >::control_block::destroy( control_block * cb) noexcept { boost::context::fiber c = std::move( cb->c); - // destroy control structure - cb->~control_block(); // destroy coroutine's stack cb->state |= state_t::destroy; + // destroy control structure + cb->~control_block(); } template< typename StackAllocator, typename Fn >