fixed proper async call of forceUpdateDisplay()

This commit is contained in:
csoler 2019-12-06 22:19:49 +01:00
parent bb10b82c8e
commit d152d9f50c
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -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<const RsEvent> e)
{
if(dynamic_cast<const RsConnectionEvent*>(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()