CRESS-Surrey/eXtraWidgets

Synchronize all property access to a single thread

nicolaspayette opened this issue · 0 comments

Timing issues between things happening from code and things happening from the GUI are delicate. #156 is a good example of that.

As discussed with @qiemem on Gitter (https://gitter.im/CRESS-Surrey/eXtraWidgets?at=5548ec8952bceea22c3813dd):

All these problems stem from the fact that the widget models (i.e., Reader/Writer) can be accessed from both the job thread and the awt event thread. I didn't think of that before, but what if every call to reader/writer was blocking and ran: on the job thread if running headless; on the event thread otherwise. Since the job thread is allowed to wait on the event thread and that the opposite would never happen, would wouldn't get locking. And we'd have the garantee that everything always happens in the right order.
That's not a trivial change, however...