common: Make InternalPeer (more) thread-safe
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 30 May 2018 20:01:50 +0000 (22:01 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 6 Jun 2018 19:12:17 +0000 (21:12 +0200)
The two internal peers used by a mono client live in different
threads. Previously, they each stored a pointer to their counterpart
to be able to send protocol messages wrapped in an event.
While this has never been observed in the wild, this may cause subtle
lifetime issues if one of the sides goes away before the other.

While currently, as the two peers are at least created in the same
thread (and thus, setting the mutual pointer should not cause issues),
this will change in the near future, since the mono core is slated
to move into its own thread.

Rather than trying to deal with this ourselves, let Qt do the work.
Instead of storing a pointer and sending events, use signal/slot
connections to transfer the messages between the peers. Qt will
ensure that this happens in a thread-safe manner, and that connections
are killed if one of the peers is destroyed.


No differences found