summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-07-16 01:18:00 +0200
committerCarl Hetherington <cth@carlh.net>2025-07-16 22:27:53 +0200
commitdd0f2c82554c5177544e36532085c0a631b4f1fc (patch)
treec8e63d31eff4ee6734b839eb0d9fed328d5b1dad /src
parent2a7f3a1840bf2495656efff17a6c35ab3873b441 (diff)
Squash change signals with the same property and type.
There's a bit of an assumption here that handlers don't need to be told multiple times about the same change (to different pieces of content) but that seems reasonable.
Diffstat (limited to 'src')
-rw-r--r--src/lib/change_signaller.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/change_signaller.h b/src/lib/change_signaller.h
index 0b2c1539d..094716598 100644
--- a/src/lib/change_signaller.h
+++ b/src/lib/change_signaller.h
@@ -71,7 +71,14 @@ public:
{
if (_suspended) {
boost::mutex::scoped_lock lm(_mutex);
- _pending.push_back(signal);
+ auto iter = std::find_if(
+ _pending.begin(),
+ _pending.end(),
+ [signal](ChangeSignal<T, P> const& s) { return s.property == signal.property && s.type == signal.type; }
+ );
+ if (iter == _pending.end()) {
+ _pending.push_back(signal);
+ }
} else {
signal.thing->signal_change(signal.type, signal.property);
}