View Full Version : [FNR] (Beta) TriggerFieldCell racing conditions

8 Dec 2011, 11:39 AM
Looks like there are racing conditions in TriggerFieldCell class. Sometimes selected value (e.g. in ComboBox) is not updated in CellComponent, though cell itself contains it. There are three methods in TriggerFieldCell that, I suppose, called in wrong order for some reason.

Here is the custom ComboBoxCell just to log the methods calls order:

ComboBoxCell<Type> customCell = new ComboBoxCell<Type>(typeStore, typeProperties.title(), typeProperties.title()) {
protected void clearContext() {

protected void saveContext(Context context, Element parent, NativeEvent event, ValueUpdater<Type> typeValueUpdater, Type value) {
super.saveContext(context, parent, event, typeValueUpdater, value);

protected void finishEditing(Element parent, Type value, Object key, ValueUpdater<Type> typeValueUpdater) {
super.finishEditing(parent, value, key, typeValueUpdater);

Here what I get in the log:

(AttributeViewImpl.java:87) 2011-12-08 22:03:34,950 [INFO ] clearContext
(AttributeViewImpl.java:99) 2011-12-08 22:03:42,419 [INFO ] finishEditing
(AttributeViewImpl.java:93) 2011-12-08 22:03:42,481 [INFO ] saveContext

The problem is that clearContext sets valueUpdater to null:

protected void clearContext() {
lastContext = null;
lastParent = null;
lastValueUpdater = null;
lastValue = null;

But the TriggerFieldCell.finishEditing(...) requires lastValueUpdater to be not null in order to update value in it:

// Fire the value updater if the value has changed.
if (valueUpdater != null && !vd.getCurrentValue().equals(vd.getLastValue())) {
... // updating value in component

If I set a break point in clearContext() which is called from collapse(), resume execution, then saveContext() is called prior finishEditing method call (I think it because browser events occurre).

15 Dec 2011, 2:30 PM
Thanks for digging into the code and providing a detailed report. This is now fixed in SVN. We made several changes around the order in which code is executed during an edit. You can see the latest code here:


Let me know if you see anything not working correctly. Changes will go out next week in our beta 2 release.