mirror of
https://github.com/boostorg/fiber.git
synced 2026-07-21 13:13:32 +00:00
c4708c7bd7
Commit37b5f770(#209) added an explicit destructor call in operator++() for channel iterators. Later, commite4406238(#258) added the same destructor call inside increment_() which operator++() calls. This results in the destructor running twice on every iterator increment, causing undefined behavior (double-free) for non-trivially-destructible types. This bug affects all users of range-for loops over buffered_channel and unbuffered_channel with types like std::string, shared_ptr, etc. Fix by removing the redundant destructor call in operator++() since increment_() already handles it correctly. Regression test uses a type with an atomic destruction counter to verify objects are destroyed exactly once.