@@ -243,47 +243,41 @@ void ClientModel::TipChanged(SynchronizationState sync_state, interfaces::BlockT
243243
244244void ClientModel::subscribeToCoreSignals ()
245245{
246- m_handler_show_progress = m_node.handleShowProgress (
246+ m_event_handlers. emplace_back ( m_node.handleShowProgress (
247247 [this ](const std::string& title, int progress, [[maybe_unused]] bool resume_possible) {
248248 Q_EMIT showProgress (QString::fromStdString (title), progress);
249- });
250- m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged (
249+ })) ;
250+ m_event_handlers. emplace_back ( m_node.handleNotifyNumConnectionsChanged (
251251 [this ](int new_num_connections) {
252252 Q_EMIT numConnectionsChanged (new_num_connections);
253- });
254- m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged (
253+ })) ;
254+ m_event_handlers. emplace_back ( m_node.handleNotifyNetworkActiveChanged (
255255 [this ](bool network_active) {
256256 Q_EMIT networkActiveChanged (network_active);
257- });
258- m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged (
257+ })) ;
258+ m_event_handlers. emplace_back ( m_node.handleNotifyAlertChanged (
259259 [this ]() {
260260 qDebug () << " ClientModel: NotifyAlertChanged" ;
261261 Q_EMIT alertsChanged (getStatusBarWarnings ());
262- });
263- m_handler_banned_list_changed = m_node.handleBannedListChanged (
262+ })) ;
263+ m_event_handlers. emplace_back ( m_node.handleBannedListChanged (
264264 [this ]() {
265265 qDebug () << " ClienModel: Requesting update for peer banlist" ;
266266 QMetaObject::invokeMethod (banTableModel, [this ] { banTableModel->refresh (); });
267- });
268- m_handler_notify_block_tip = m_node.handleNotifyBlockTip (
267+ })) ;
268+ m_event_handlers. emplace_back ( m_node.handleNotifyBlockTip (
269269 [this ](SynchronizationState sync_state, interfaces::BlockTip tip, double verification_progress) {
270270 TipChanged (sync_state, tip, verification_progress, SyncType::BLOCK_SYNC);
271- });
272- m_handler_notify_header_tip = m_node.handleNotifyHeaderTip (
271+ })) ;
272+ m_event_handlers. emplace_back ( m_node.handleNotifyHeaderTip (
273273 [this ](SynchronizationState sync_state, interfaces::BlockTip tip, bool presync) {
274274 TipChanged (sync_state, tip, /* verification_progress=*/ 0.0 , presync ? SyncType::HEADER_PRESYNC : SyncType::HEADER_SYNC);
275- });
275+ })) ;
276276}
277277
278278void ClientModel::unsubscribeFromCoreSignals ()
279279{
280- m_handler_show_progress->disconnect ();
281- m_handler_notify_num_connections_changed->disconnect ();
282- m_handler_notify_network_active_changed->disconnect ();
283- m_handler_notify_alert_changed->disconnect ();
284- m_handler_banned_list_changed->disconnect ();
285- m_handler_notify_block_tip->disconnect ();
286- m_handler_notify_header_tip->disconnect ();
280+ m_event_handlers.clear ();
287281}
288282
289283bool ClientModel::getProxyInfo (std::string& ip_port) const
0 commit comments