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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nikolaykasyanov
Copy link

@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
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
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

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.

2 participants