From b16c30bc3fe20b5520dc43d62b4ab687c4d6ed80 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 26 Feb 2021 23:20:48 +0100 Subject: [PATCH] fixed registration of event handler --- libretroshare/src/rsserver/p3peers.cc | 3 +-- retroshare-gui/src/gui/common/NewFriendList.cpp | 4 +++- retroshare-gui/src/gui/common/NewFriendList.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 4bcb09694..c44877fc5 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -128,8 +128,7 @@ bool p3Peers::FriendsChanged(const RsPeerId& pid,bool add) #endif if(rsEvents) { - auto ev = std::make_shared(); - ev->mSslId = pid; + auto ev = std::make_shared(pid); rsEvents->postEvent(ev); } RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL); // this is meant to disappear diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index 7f139b794..1cfa05ef4 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -178,8 +178,9 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par mEventHandlerId_peer=0; // forces initialization mEventHandlerId_gssp=0; // forces initialization + mEventHandlerId_pssc=0; // forces initialization - rsEvents->registerEventsHandler( [this](std::shared_ptr e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_STATE_CHANGED ); + rsEvents->registerEventsHandler( [this](std::shared_ptr e) { handleEvent(e); }, mEventHandlerId_pssc, RsEventType::PEER_STATE_CHANGED ); rsEvents->registerEventsHandler( [this](std::shared_ptr e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_CONNECTION ); rsEvents->registerEventsHandler( [this](std::shared_ptr e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY ); @@ -267,6 +268,7 @@ NewFriendList::~NewFriendList() { rsEvents->unregisterEventsHandler(mEventHandlerId_peer); rsEvents->unregisterEventsHandler(mEventHandlerId_gssp); + rsEvents->unregisterEventsHandler(mEventHandlerId_pssc); delete mModel; delete mProxyModel; diff --git a/retroshare-gui/src/gui/common/NewFriendList.h b/retroshare-gui/src/gui/common/NewFriendList.h index 79b2d0a5a..224cc0a11 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.h +++ b/retroshare-gui/src/gui/common/NewFriendList.h @@ -123,6 +123,7 @@ private: bool mShowState; RsEventsHandlerId_t mEventHandlerId_peer; RsEventsHandlerId_t mEventHandlerId_gssp; + RsEventsHandlerId_t mEventHandlerId_pssc; std::set openGroups; std::set openPeers;