Issue 62519 - Event is fired even for identical value
Summary: Event is fired even for identical value
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 08:41 UTC by ocke.janssen
Modified: 2017-05-20 11:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ocke.janssen 2006-02-24 08:41:41 UTC
The propertysetmixin helper class fires events even when the same value is set
again.
Comment 1 Stephan Bergmann 2006-02-24 10:13:29 UTC
Eliminating that superfluous notification can be a performance improvement. 
However, whether or not the notification is sent should not make a difference to
correctness (I think).
Comment 2 Stephan Bergmann 2006-03-23 10:20:38 UTC
At the time the notifications are about to be sent, the old and new value (on
which the decision whether to sent notifications would be based) are not known
(the values need not be provided in a call to prepareSet, might be obsolete by
the time the notifications are about to be sent, and the code that decides
whether to send notifications cannot easily read the old value safely in a
multithreaded scenario).  A possible solution would be to change prepareSet to
do nothing if oldValue equals newValue (and leave the bound listeners empty). 
However:
1  This would require every caller of prepareSet to supply oldValue and
newValue, which is highly undesirable.
2  This can easily be done by client code (that is willing to make available
oldValue prior to setting newValue): if oldValue equals newValue, do not perform
the sequence of calling prepareSet, setting the new value, and calling
BoundListeners.notify.  (Watch out that at least C++
com::sun::star::uno::Any::operator== and Java com.sun.star.uno.Any.equals have
slightly different semantics, when doing the check for equality of oldValue and
newValue).
3  This could of course also be offered as an additional helper function at
ProperytSetMixin:
  bool prepareSetIfDifferent(propertyName, oldValue, newValue, boundListeners)
which would require oldValue and newValue to be set.

Ocke, in light of the above, would you agree that this issue should be solved in
the client code, or would you prefer a corresponding helper function bool
prepareSetIfDifferent(...) at PropertySetMixin?
Comment 3 ocke.janssen 2006-03-23 12:13:04 UTC
Hi Stephan,

I would prefer a corresponding helper function bool prepareSetIfDifferent(...)
at PropertySetMixin so that we could avoid duplicate code :-)


- Ocke
Comment 4 Marcus 2017-05-20 11:27:28 UTC
Reset assigne to the default "issues@openoffice.apache.org".