@@ -243,47 +243,41 @@ void ClientModel::TipChanged(SynchronizationState sync_state, interfaces::BlockT
243
243
244
244
void ClientModel::subscribeToCoreSignals ()
245
245
{
246
- m_handler_show_progress = m_node.handleShowProgress (
246
+ m_event_handlers. emplace_back ( m_node.handleShowProgress (
247
247
[this ](const std::string& title, int progress, [[maybe_unused]] bool resume_possible) {
248
248
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 (
251
251
[this ](int new_num_connections) {
252
252
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 (
255
255
[this ](bool network_active) {
256
256
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 (
259
259
[this ]() {
260
260
qDebug () << " ClientModel: NotifyAlertChanged" ;
261
261
Q_EMIT alertsChanged (getStatusBarWarnings ());
262
- });
263
- m_handler_banned_list_changed = m_node.handleBannedListChanged (
262
+ })) ;
263
+ m_event_handlers. emplace_back ( m_node.handleBannedListChanged (
264
264
[this ]() {
265
265
qDebug () << " ClienModel: Requesting update for peer banlist" ;
266
266
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 (
269
269
[this ](SynchronizationState sync_state, interfaces::BlockTip tip, double verification_progress) {
270
270
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 (
273
273
[this ](SynchronizationState sync_state, interfaces::BlockTip tip, bool presync) {
274
274
TipChanged (sync_state, tip, /* verification_progress=*/ 0.0 , presync ? SyncType::HEADER_PRESYNC : SyncType::HEADER_SYNC);
275
- });
275
+ })) ;
276
276
}
277
277
278
278
void ClientModel::unsubscribeFromCoreSignals ()
279
279
{
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 ();
287
281
}
288
282
289
283
bool ClientModel::getProxyInfo (std::string& ip_port) const
0 commit comments