Fix bug causing signal changes to be lost (#2870).
authorCarl Hetherington <cth@carlh.net>
Tue, 8 Oct 2024 17:49:33 +0000 (19:49 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 8 Oct 2024 17:49:33 +0000 (19:49 +0200)
It was possible (and I believe it happend) for new signals to be queued
up in _pending while some old ones were being processed.  They would
then be cleared at the end of resume() without ever being sent.

src/lib/change_signaller.h

index cda36607693de3fdfff6536ab313ceb65f29c34a..0b2c1539d621d4f22bca44f83d48cfaea1969ead 100644 (file)
@@ -87,15 +87,13 @@ public:
        {
                boost::mutex::scoped_lock lm(_mutex);
                auto pending = _pending;
+               _pending.clear();
+               _suspended = false;
                lm.unlock();
 
                for (auto signal: pending) {
                        signal.thing->signal_change(signal.type, signal.property);
                }
-
-               lm.lock();
-               _pending.clear();
-               _suspended = false;
        }
 
        static ChangeSignalDespatcher* instance()