From d152d9f50ca361fc441653c8f1cf9693e69918cd Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 6 Dec 2019 22:19:49 +0100 Subject: [PATCH] fixed proper async call of forceUpdateDisplay() --- retroshare-gui/src/gui/common/NewFriendList.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index 417e1a279..e3dc2b015 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -47,6 +47,7 @@ #include "RSTreeWidgetItem.h" #include "StatusDefs.h" #include "util/misc.h" +#include "util/qtthreadsutils.h" #include "vmessagebox.h" #include "util/QtVersion.h" #include "gui/chat/ChatUserNotify.h" @@ -257,7 +258,12 @@ NewFriendList::NewFriendList(QWidget *parent) : /* RsAutoUpdatePage(5000,parent) void NewFriendList::handleEvent(std::shared_ptr e) { if(dynamic_cast(e.get()) != nullptr) - forceUpdateDisplay(); + { + // /!\ 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. + + RsQThreadUtils::postToObject( [=]() { forceUpdateDisplay() ; }, this ) ; + } } NewFriendList::~NewFriendList()