Skip to content

Upgrading v4 to v5 panic: Listener was never inserted into the list #124

@jbr

Description

@jbr

I'm unsure if I'm holding the new interface wrong somehow or if I've encountered a bug.

Given this diff that attempts to track the event-listener interface changes, I'm encountering a deterministic panic like:

event-listener-5.2.0/src/lib.rs:1251:36:
listener was never inserted into the list

and as far as I can tell the code reduces to

let n = AtomicUsize::from(1);
let event = Event::new();
let mut listener = event.listen();
loop {
    if 0 == n.load(Ordering::SeqCst) {
        return Poll::Ready(());
    };
    ready!(Pin::new(&mut listener).poll(cx));
}

Do I need to replace the listener every time I poll it? Am I holding this wrong? Is this a bug?

If I'm using it wrong I'll happily contribute documentation to help others avoid this error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions