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

Fix ValueObservation duration - code & doc #458

Merged
merged 5 commits into from
Dec 9, 2018

Conversation

groue
Copy link
Owner

@groue groue commented Dec 8, 2018

This PR fixes a bug in ValueObservation, where unwanted notifications could happen despite deallocation of the observer returned by the ValueObservation.start method.

var observer: TransactionObserver? = valueObservation.start(in: dbQueue) { _ in
    print ("database has changed")
}
...
// fixed: now guarantees that "database has changed" won't be printed
// past this point.
observer = nil

Documentation has also been updated in order to warn about unsafe ways to control the duration of observation.

@groue groue changed the base branch from master to development December 8, 2018 16:36
@groue groue added the bug label Dec 8, 2018
@groue groue merged commit b34030f into development Dec 9, 2018
@groue groue deleted the feature/FixValueObserverOverRetain branch December 9, 2018 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant