RFR: 8301763: Adding children to wrong index leaves inconsistent state in Parent#childrenSet [v2]
John Hendrikx
jhendrikx at openjdk.org
Wed May 17 23:17:56 UTC 2023
On Wed, 17 May 2023 16:40:01 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
> As a small note, the issue is solved with current patches, however I think the best solution would be what I mentioned in the original PR message - an interface in `VetoableListDecorator` which would let us "roll-back" any changes from `onProposedChange` (ex. revert `childSet` to original state) when backing lists throw an exception. This would require a more thorough analysis of what bits use `VetoableListDecorator` and if any roll-backs are necessary there in addition to Parent code.
I'm not convinced this is needed or desirable. The `VetoableListDecorator` is currently set up that its owner can already make "preparations" for the change when it knows it won't veto it (there can be only one vetoer, making this reasonable). Furthermore, it has the wrapped list under its own control, so it knows what to expect (no exceptions can occur (after this fix) if it decides not to veto).
A roll back mechanism would just complicate the code for very little benefit (a correct FX application won't run into these situations, you'll only be likely to encounter them during development). The whole mechanism surrounding the children list and bad additions should be seen as a best effort early warning system (like ConcurrentModificationExeption).
With this fix I don't see any other ways you could get it in a bad state.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1136#issuecomment-1552201754
More information about the openjfx-dev
mailing list