CSSTUDIO-3164 Bugfix: reset 'pv_value' when the PV name changes. #3406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes a bug that can be reproduced in the following way:
PV1
.2.a. Change the TextUpdate widget's PV to a non-existent PV
PV2
, causing the TextUpdate widget to display<PV2>
and a disconnected status.2.b. Change the TextUpdate widget's PV back to the original PV
PV1
. Instead of displaying the value of the original PV, the TextUpdate widget now disiplays<PV2>
. (But it no longer displays the disconnected status.)The reason for this behavior is an optimization in the class
PropertyChangeHandler
, which doesn't notify listeners if the value of a property remains unchanged:phoebus/app/display/model/src/main/java/org/csstudio/display/builder/model/properties/PropertyChangeHandler.java
Lines 167 to 169 in 8ba0923
When the PV name was changed in step 2.a above, the property
pv_value
in the classPVWidget
remained unchanged, sincePV2
didn't exist. In step 2.b, when the PV name was changed back toPV1
, the optimization inPropertyChangeHandler
prevented the notification of the TextUpdate widget, and the displayed text was not updated from<PV2>
to the value ofPV1
.This pull request adds a
WidgetPropertyListener
to the propertypv_name
that resets the propertypv_value
tonull
wheneverpv_name
is updated.