From 5a27754404d587deec76fe834911a4fa3e33e7a5 Mon Sep 17 00:00:00 2001 From: Stephane Guy Date: Wed, 16 Jun 2021 10:10:32 +0200 Subject: [PATCH] Fix __stop_state double delete. --- source/stop_token.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/stop_token.hpp b/source/stop_token.hpp index 44839fd..7f695e2 100644 --- a/source/stop_token.hpp +++ b/source/stop_token.hpp @@ -53,7 +53,7 @@ struct __stop_state { void __remove_token_reference() noexcept { auto __oldState = __state_.fetch_sub(__token_ref_increment, std::memory_order_acq_rel); - if (__oldState < (__token_ref_increment + __source_ref_increment)) { + if (__oldState < (__token_ref_increment + __token_ref_increment)) { delete this; } }