mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-18 11:51:51 +03:00
Ensure avatarJob is run on the respective account's QNAM thread
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
5b5c5e3ac7
commit
13141db2ed
1 changed files with 13 additions and 5 deletions
|
@ -1650,12 +1650,20 @@ public:
|
||||||
qCWarning(lcActivity) << "Invalid account:" << accountString;
|
qCWarning(lcActivity) << "Invalid account:" << accountString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto avatarSize = requestedSize.width() > 0 ? requestedSize.width() : 64;
|
|
||||||
const auto avatarJob = new AvatarJob(accountState->account(), avatarUserId, avatarSize);
|
const auto account = accountState->account();
|
||||||
connect(avatarJob, &AvatarJob::avatarPixmap, this, [&](const QImage &avatarImg) {
|
const auto qnam = account->networkAccessManager();
|
||||||
handleDone(AvatarJob::makeCircularAvatar(avatarImg));
|
|
||||||
|
QMetaObject::invokeMethod(qnam, [this, requestedSize, avatarUserId, account]() {
|
||||||
|
const auto avatarSize = requestedSize.width() > 0 ? requestedSize.width() : 64;
|
||||||
|
const auto avatarJob = new AvatarJob(account, avatarUserId, avatarSize);
|
||||||
|
connect(avatarJob, &AvatarJob::avatarPixmap, this, [&](const QImage &avatarImg) {
|
||||||
|
QMetaObject::invokeMethod(this, [this, avatarImg] {
|
||||||
|
handleDone(AvatarJob::makeCircularAvatar(avatarImg));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
avatarJob->start();
|
||||||
});
|
});
|
||||||
avatarJob->start();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue