Skip to content

Settled C++ Promises retain impossible listeners #1559

Description

@OskarEichler

Description

Promise<T> and Promise<void> enqueue a listener whenever the Promise is not already settled with that listener's matching outcome. Adding a rejection listener to an already-resolved Promise—or a resolution listener to an already-rejected Promise—therefore retains the callback and everything it captures until the Promise itself is destroyed, even though that callback can never run.

This is the C++ Promise implementation; open PR #1441 concerns the separate Android JPromise implementation.

Expected behavior

Listeners should be queued only while a Promise is pending. A listener for an impossible outcome on an already-settled Promise should be discarded immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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