diff --git a/Telegram/SourceFiles/base/binary_guard.h b/Telegram/SourceFiles/base/binary_guard.h index aa688fa7c..1e5a0ee58 100644 --- a/Telegram/SourceFiles/base/binary_guard.h +++ b/Telegram/SourceFiles/base/binary_guard.h @@ -57,10 +57,10 @@ inline void binary_guard::kill() { } inline void binary_guard::destroy() { - if (_bothAlive) { + if (const auto both = base::take(_bothAlive)) { auto old = true; - if (!_bothAlive->compare_exchange_strong(old, false)) { - delete _bothAlive; + if (!both->compare_exchange_strong(old, false)) { + delete both; } } }