Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't retain receiver of Completable.andThen beyond its completion #2604

Merged

Conversation

nikolaykasyanov
Copy link
Contributor

@nikolaykasyanov nikolaykasyanov commented May 24, 2024

Otherwise the creation closure and operator closures involved in the Completable (and hence all objects captured by them) are retained until the outer stream completes or terminates with error.

private let subscription = SerialDisposable()

init(parent: Parent, observer: Observer, cancel: Cancelable) {
self.parent = parent
Copy link
Contributor Author

@nikolaykasyanov nikolaykasyanov May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether not retaining parent is the right thing to do.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very much like the change I made for the deferred code (214f7ff). If the Completable has emitted a completed event, there is no reason to keep it around.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielt1263 indeed! Given its similarity to the deferred fix, I wonder if this PR can be considered for a minor release? cc @freak4pc

Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If tests pass this LGTM!

@freak4pc freak4pc closed this Oct 4, 2024
@freak4pc freak4pc reopened this Oct 4, 2024
@freak4pc freak4pc merged commit 98f63d1 into ReactiveX:main Oct 4, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants