smol-rs / async-broadcast

Async broadcast channels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InactiveReceiver panics on Drop

bltavares opened this issue · comments

When an InactiveReceiver is cloned, it does not increase the count of inactive receivers, and an error with the recent inactive receiver drop.

thread 'main' panicked at 'attempt to subtract with overflow', C:\Users\bltav\.cargo\registry\src\github.com-1ecc6299db9ec823\async-broadcast-0.3.1\src\lib.rs:1562:13

Reproduced on:

fn main() {
    let (_, active_receiver) = async_broadcast::broadcast::<()>(1);
    let inactive = active_receiver.deactivate();
    let inactive2 = inactive.clone();
    drop(inactive);
    drop(inactive2);
}