RFR: 8243115: Spurious invalidations due to bug in IntegerBinding and other classes [v2]
Ambarish Rapte
arapte at openjdk.org
Fri Jan 6 09:37:01 UTC 2023
On Tue, 3 Jan 2023 09:54:42 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> This fixes a bug where the first call to unbind would clear the internal invalidation listener used, resulting in subsequent unbind calls to be no-ops, unless bind was called again first.
>>
>> I had to rewrite the parameterized test slightly as Parameterized will only call the parameters method once, and my new test modifies the internal state of the bindings used as parameters (by doing some unbind calls) which was making other tests fail.
>
> John Hendrikx has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'master' of https://git.openjdk.org/jfx into feature/unbind
> - 8243115: Unregister bindings when unbind called multiple times
>
> This fixes a bug where the first call to unbind would clear the internal invalidation listener used, resulting in subsequent unbind calls to be no-ops, unless bind was called again first.
> ```diff
> /**
> * Start observing the dependencies for changes. If the value of one of the
> * dependencies changes, the binding is marked as invalid.
> *
> * @param dependencies
> * the dependencies to observe
> + * @throws NullPointerException when dependencies is null, or any of its elements was null
> */
> protected final void bind(Observable... dependencies) {
> - if ((dependencies != null) && (dependencies.length > 0)) {
> + if (dependencies.length > 0) {
> if (observer == null) {
> observer = new BindingHelperObserver(this);
> }
> for (final Observable dep : dependencies) {
> dep.addListener(observer);
> }
> }
> }
> ```
I would not recommend to make this change as it may break any existing app, even though the app is at wrong to pass `null` Or atleast not to make this change as part of this PR, we can discuss it separately under a new bug.
-------------
PR: https://git.openjdk.org/jfx/pull/198
More information about the openjfx-dev
mailing list