diff --git a/src/fdosecrets/objects/Prompt.cpp b/src/fdosecrets/objects/Prompt.cpp index aa0de5404..1ac7e306f 100644 --- a/src/fdosecrets/objects/Prompt.cpp +++ b/src/fdosecrets/objects/Prompt.cpp @@ -297,15 +297,15 @@ namespace FdoSecrets continue; } auto entry = item->backend(); - if (client->itemKnown(entry->uuid())) { - if (!client->itemAuthorized(entry->uuid())) { + auto uuid = entry->uuid(); + if (client->itemKnown(uuid)) { + if (!client->itemAuthorized(uuid)) { m_numRejected += 1; } + // Already saw this entry continue; } - // attach a temporary property, so later we can get the item - // back from the dialog's result - entry->setProperty(FdoSecretsBackend, QVariant::fromValue(item.data())); + m_entryToItems[uuid] = item.data(); entries << entry; } } @@ -331,15 +331,17 @@ namespace FdoSecrets } for (auto it = decisions.constBegin(); it != decisions.constEnd(); ++it) { auto entry = it.key(); + auto uuid = entry->uuid(); // get back the corresponding item - auto item = entry->property(FdoSecretsBackend).value(); - entry->setProperty(FdoSecretsBackend, {}); - Q_ASSERT(item); + auto item = m_entryToItems.value(uuid); + if (!item) { + continue; + } // set auth - client->setItemAuthorized(entry->uuid(), it.value()); + client->setItemAuthorized(uuid, it.value()); - if (client->itemAuthorized(entry->uuid())) { + if (client->itemAuthorized(uuid)) { m_unlocked += item->objectPath(); } else { m_numRejected += 1; diff --git a/src/fdosecrets/objects/Prompt.h b/src/fdosecrets/objects/Prompt.h index 599343564..1727f4424 100644 --- a/src/fdosecrets/objects/Prompt.h +++ b/src/fdosecrets/objects/Prompt.h @@ -172,10 +172,10 @@ namespace FdoSecrets void itemUnlockFinished(const QHash& results, AuthDecision forFutureEntries); void unlockItems(); - static constexpr auto FdoSecretsBackend = "FdoSecretsBackend"; - QList> m_collections; QHash>> m_items; + QHash m_entryToItems; + QList m_unlocked; int m_numRejected = 0;