Fix potential race condition for receiving messages


When iterating through the list of active subscriptions to emit the
messageReceived signal, the handler can add further subscriptions, which
renders the iterator to be invalid. Instead store the subscriptions in a
list, which are supposed to receive the signal and only act upon these.

Fixes: QTBUG-106203
Pick-to: 6.4 6.2 5.15
Change-Id: I790a6081c332e82da8e53b15df8ad8494f35cc46
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
commit5277f58a2afd2a9b00e6ebc380d069511da1daf6
parentc7174f78fd91542f20cf92439227e7f413cbafc2
authorMaurice Kalinowski <maurice.kalinowski@qt.io>
committerMaurice Kalinowski <maurice.kalinowski@qt.io>
commit timeWed, 19 Oct 2022 06:41:12 +0200