Skip to content

Buffer if clearing fix - #277

Merged
RolandPheasant merged 3 commits into
reactivemarbles:masterfrom
Noggog:BufferIf-clearing-fix
Sep 23, 2019
Merged

Buffer if clearing fix#277
RolandPheasant merged 3 commits into
reactivemarbles:masterfrom
Noggog:BufferIf-clearing-fix

Conversation

@Noggog

@Noggog Noggog commented Sep 21, 2019

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?
A hopeful fix for ObservableList BufferIf usage being more reliable downstream, especially when used /w delaying calls like ObserveOn.

The change makes a new list for the internal buffer when firing, rather than reusing the same list that was provided to ChangeSet.

What is the current behavior?
Current behavior reuses the same internal buffer list for the outgoing ChangeSet that it is firing. This meant that the subsequent Clear() call on the buffer list would clear the ChangeSet as well, as it was the same list. This only became a problem if the ChangeSet consumption was delayed by an ObserveOn call or something similar.

What is the new behavior?
When executing an event, it passes the internal buffer to the ChangeSet to be used directly. A new list is then created for the internal buffer variable to be filled with new data.

An alternate route could have been constructing a new list and copying over the buffer's data to be given to the ChangeSet, and then clearing the buffer. The current setup felt like less processing with the same results.

What might this PR break?
ObservableList BufferIf calls in general. Might not be a full fix for all possible threading scenarios. Might be some oddball edge cases not yet considered.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

If only a pause observable was provided, the method signatures were ambiguous
The internal buffer storage list was directly passed to the outgoing ChangeSet, so when cleared it would affect callbacks processing downstream.  Would become most apparent if ObserveOn was used that delayed the processing of the ChangeSet
@dnfclas

dnfclas commented Sep 21, 2019

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

Comment thread src/DynamicData/List/ObservableListEx.cs
Comment thread src/DynamicData/List/Internal/BufferIf.cs
@RolandPheasant
RolandPheasant merged commit 5d83274 into reactivemarbles:master Sep 23, 2019
@Noggog
Noggog deleted the BufferIf-clearing-fix branch September 23, 2019 17:54
@lock lock Bot locked and limited conversation to collaborators Dec 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants