From dd0f2c82554c5177544e36532085c0a631b4f1fc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 16 Jul 2025 01:18:00 +0200 Subject: 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. --- src/lib/change_signaller.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 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); } -- cgit v1.2.3