summary refs log tree commit diff
path: root/src/encryption/VerificationManager.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-07-22 11:46:22 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-07-22 11:46:37 +0200
commit904745543a69b15a8aa06ce51ffc0bcd65bf2ba4 (patch)
tree198860b4a59524457c270717f971201c86bdcc0c /src/encryption/VerificationManager.cpp
parentTranslated using Weblate (Russian) (diff)
downloadnheko-904745543a69b15a8aa06ce51ffc0bcd65bf2ba4.tar.xz
Verifications sneakily accumulating in the background
Diffstat (limited to '')
-rw-r--r--src/encryption/VerificationManager.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/encryption/VerificationManager.cpp b/src/encryption/VerificationManager.cpp

index 8c775948..ca712922 100644 --- a/src/encryption/VerificationManager.cpp +++ b/src/encryption/VerificationManager.cpp
@@ -116,12 +116,18 @@ VerificationManager::verifyUser(QString userid) if (auto model = rooms_->getRoomById(QString::fromStdString(room_id))) { auto flow = DeviceVerificationFlow::InitiateUserVerification(this, model.data(), userid); - connect(model.data(), - &TimelineModel::updateFlowEventId, - this, - [this, flow](std::string eventId) { - dvList[QString::fromStdString(eventId)] = flow; - }); + std::unique_ptr<QObject> context{new QObject(flow.get())}; + QObject *pcontext = context.get(); + connect( + model.data(), + &TimelineModel::updateFlowEventId, + pcontext, + [this, flow, context = std::move(context)](std::string eventId) mutable { + if (context->parent() == flow.get()) { + dvList[QString::fromStdString(eventId)] = flow; + context.reset(); + } + }); emit newDeviceVerificationRequest(flow.data()); return; } @@ -137,8 +143,9 @@ VerificationManager::verifyUser(QString userid) void VerificationManager::removeVerificationFlow(DeviceVerificationFlow *flow) { + nhlog::crypto()->debug("Removing verification flow {}", (void *)flow); for (auto it = dvList.keyValueBegin(); it != dvList.keyValueEnd(); ++it) { - if ((*it).second == flow) { + if (it->second == flow) { dvList.remove((*it).first); return; }