cpp: Ensure that hasSecret is correct after update

* lang/cpp/src/key.cpp (Key::update): Check for
a secret key first before listing public keys.

--
This is a performance delay but the update should
only be called in a non gui thread anyway. The information
if we have the secret key for this key is important to provide
after update.
This commit is contained in:
Andre Heinecke 2016-12-16 19:09:13 +01:00
parent 85e05537e1
commit da5343a9d2

View File

@ -341,7 +341,12 @@ void Key::update()
KeyListMode::Validate |
KeyListMode::WithTofu);
Error err;
auto newKey = ctx->key(primaryFingerprint(), err, hasSecret());
auto newKey = ctx->key(primaryFingerprint(), err, true);
// Not secret so we get the information from the pubring.
if (newKey.isNull())
{
newKey = ctx->key(primaryFingerprint(), err, false);
}
delete ctx;
if (err) {
return;