[pim/kleopatra/release/26.08] src/commands: Avoid crash when modifying iterated list
Ingo Klöcker <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 7457e661c67e7176b5ac7adc2152977e3c5577d8 by Ingo Klöcker, on behalf of Ingo Klöcker.
Committed on 29/07/2026 at 12:06.
Pushed by kloecker into branch 'release/26.08'.
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.
(cherry picked from commit 69927b31f8437e30fe6e31748142dfa027c86843)
M +2 -1 src/commands/decryptverifyfilescommand.cpp
https://invent.kde.org/pim/kleopatra/-/commit/7457e661c67e7176b5ac7adc2152977e3c5577d8
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;