mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-01 21:56:06 -04:00
fixed bug caused by calling GUI out of main GUI thread
This commit is contained in:
parent
f9bb886c27
commit
aa16be6450
1 changed files with 7 additions and 4 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "retroshare/rsfiles.h"
|
||||
#include "hashingstatus.h"
|
||||
#include "gui/common/ElidedLabel.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
|
||||
|
@ -54,13 +55,13 @@ HashingStatus::HashingStatus(QWidget *parent)
|
|||
statusHashing->hide();
|
||||
|
||||
mEventHandlerId=0;
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event) { handleEvent(event); },
|
||||
mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::SHARED_DIRECTORIES );
|
||||
}
|
||||
|
||||
void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
// Warning: no GUI calls should happen here!
|
||||
|
||||
if(event->mType != RsEventType::SHARED_DIRECTORIES)
|
||||
return;
|
||||
|
||||
|
@ -85,7 +86,9 @@ void HashingStatus::handleEvent(std::shared_ptr<const RsEvent> event)
|
|||
break;
|
||||
}
|
||||
|
||||
updateHashingInfo(info);
|
||||
// GUI calls should only happen in the GUI thread, which is achieved by postToObject().
|
||||
|
||||
RsQThreadUtils::postToObject( [this,info]() { updateHashingInfo(info); }, this);
|
||||
}
|
||||
|
||||
HashingStatus::~HashingStatus()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue