[pim/kleopatra] src/commands: Avoid crash when modifying iterated list

Ingo Klöcker <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 69927b31f8437e30fe6e31748142dfa027c86843 by Ingo Klöcker, on behalf of Ingo Klöcker.
Committed on 29/07/2026 at 11:42.
Pushed by kloecker into branch 'master'.

Avoid crash when modifying iterated list

This was the only remaining problematic iteration over a std::as_const'd
container that I spotted while reviewing all such iterations.

M  +2    -1    src/commands/decryptverifyfilescommand.cpp

https://invent.kde.org/pim/kleopatra/-/commit/69927b31f8437e30fe6e31748142dfa027c86843

diff --git a/src/commands/decryptverifyfilescommand.cpp b/src/commands/decryptverifyfilescommand.cpp
index c753403b7..d084310d9 100644
--- a/src/commands/decryptverifyfilescommand.cpp
+++ b/src/commands/decryptverifyfilescommand.cpp
@@ -168,7 +168,8 @@ void DecryptVerifyFilesCommand::doStart()
             return;
         }
 
-        for (const auto &file : std::as_const(d->files)) {
+        const auto files = d->files;
+        for (const auto &file : files) {
             const unsigned int classification = classify(file);
             if (classification & Class::MimeFile) {
                 d->emailFiles << file;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.