diff --git a/libretroshare/src/retroshare/rsevents.h b/libretroshare/src/retroshare/rsevents.h index 84c41237e..123cfaf3e 100644 --- a/libretroshare/src/retroshare/rsevents.h +++ b/libretroshare/src/retroshare/rsevents.h @@ -243,6 +243,8 @@ struct RsConnectionEvent : RsEvent RsEvent::serial_process(j, ctx); RS_SERIAL_PROCESS(mConnectionInfoCode); RS_SERIAL_PROCESS(mSslId); + RS_SERIAL_PROCESS(mStrInfo1); + RS_SERIAL_PROCESS(mStrInfo2); } }; diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index f4ebc596e..8a87c2ea3 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -185,20 +185,21 @@ void NewsFeed::sortChanged(int index) // handler for the new notification system in libretroshare. void NewsFeed::handleEvent(std::shared_ptr event) +{ + // /!\ Absolutely no access to Qt structures (such as Settings) should happen here!!! + + RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); +} + +void NewsFeed::handleEvent_main_thread(std::shared_ptr event) { uint flags = Settings->getNewsFeedFlags(); if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (flags & RS_FEED_TYPE_SECURITY)) - { - RsQThreadUtils::postToObject( [=]() { handleSecurityEvent(event); }, this ); - return; - } + handleSecurityEvent(event); if(event->mType == RsEventType::PEER_CONNECTION && (flags & RS_FEED_TYPE_PEER)) - { - RsQThreadUtils::postToObject( [=]() { handleConnectionEvent(event); }, this ); - return; - } + handleConnectionEvent(event); } void NewsFeed::handleConnectionEvent(std::shared_ptr event) diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 747e86cea..52164330b 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -104,6 +104,7 @@ private slots: private: void handleSecurityEvent(std::shared_ptr event); void handleConnectionEvent(std::shared_ptr event); + void handleEvent_main_thread(std::shared_ptr event); void addFeedItem(FeedItem *item); void addFeedItemIfUnique(FeedItem *item, bool replace); diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index e3dc2b015..7b07f9086 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -177,6 +177,7 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent) ui->filterLineEdit->setPlaceholderText(tr("Search")) ; ui->filterLineEdit->showFilterIcon(); + mEventHandlerId=0; // forces initialization rsEvents->registerEventsHandler( [this](std::shared_ptr e) { handleEvent(e); }, mEventHandlerId ); mModel = new RsFriendListModel(); @@ -257,7 +258,7 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent) void NewFriendList::handleEvent(std::shared_ptr e) { - if(dynamic_cast(e.get()) != nullptr) + if(e->mType == RsEventType::PEER_CONNECTION) { // /!\ The function we're in is called from a different thread. It's very important // to use this trick in order to avoid data races.