From 6175025c822678102c3f089e37952aa84b19a3ec Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Thu, 21 Feb 2019 13:04:54 +0100 Subject: [PATCH] cpp: Make GpgME::Data::toKeys really const * lang/cpp/src/data.cpp (GpgME::Data::toKeys): Rewind afterards. -- This fixes unexpected behavior that the seek pointer is changed after calling the const toKeys. --- lang/cpp/src/data.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp index 547ec76e..7a93cbc2 100644 --- a/lang/cpp/src/data.cpp +++ b/lang/cpp/src/data.cpp @@ -256,6 +256,8 @@ std::vector GpgME::Data::toKeys(Protocol proto) const while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) { ret.push_back(GpgME::Key(key, false)); } + gpgme_data_seek (d->data, 0, SEEK_SET); + delete ctx; return ret; }