Project: Eclipse_Platform_UI
Bug 198519 [DataBinding] JavaBeanObservableValue may cause NPE when used with ComputedValue
Reported: 2007-08-01 07:33:32 | Status: verified fixed

Build ID: I20070625-1500 Steps To Reproduce: Simple case: new ComputedValue() { final IObservableValue name = BeansObservables.observeValue(dto, "name"); //$NON-NLS-1$ @Override protected Object calculate() { return name.getValue() != null; } }; More information: When ComputedValue recalculates the value, it calls the makeDirty() and then stopListening() methods which, in turn, may result in call to lastListenerRemoved() (if there are no other listeners attached) in the JavaBeanObservableValue class, causing listenerSupport.dispose() call. From now on, adding new listeners (which happens next during the calculate call) will cause NullPointerException.

Files changed in fix:
bundles/org.eclipse.core.databinding.beans/src/org/eclipse/core/internal/databinding/internal/beans/JavaBeanObservableValue.java tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/internal/beans/JavaBeanObservableValueTest.java tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/databinding/BindingTestSetup.java