This PR consists in two fixes. The first fixes a concurrency issues with boost::signals2
. The second fixes a wallet model destruction while it’s being used.
From boost signal documentation at https://www.boost.org/doc/libs/1_72_0/doc/html/signals2/thread-safety.html:
When a signal is invoked by calling signal::operator(), the invocation first acquires a lock on the signal’s mutex. Then it obtains a handle to the signal’s slot list and combiner. Next it releases the signal’s mutex, before invoking the combiner to iterate through the slot list.
This means that UnregisterValidationInterface
doesn’t prevent more calls to that interface. The fix consists in capturing the shared_ptr<CValidationInterface>
in each internal slot.
The GUI bug is fixed by using a Qt::QueuedConnection
in the WalletModel::unload
connection.