Skip to content

Unsubscribing multiple times #454

Closed
Closed
@samuelgruetter

Description

@samuelgruetter

Quoting from an email by @headinthebox, to make sure we don't forget about this issue:

Another bug in RxJava/Scala

When you create a new subscription it does not remember that is is already disposed

In scala (using trivial companion object)

Val s = Subscription{ println(“hi”) }
s.unsubscribe()
s.unsubscribe()

prints “hi” twice, in .NET only once.

In the course I will tell the students it prints only once

The issue is already present in Java:

    public static void main(String[] args) {
        Subscription s = Subscriptions.create(new Action0() {
            public void call() {
                System.out.println("hi");
            }
        });
        s.unsubscribe();
        s.unsubscribe();
    }

also prints "hi" twice.

Let's fix this first in Java, and then add a companion object Subscription to RxScala.

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