diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index c463b91..8eb496a 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -955,8 +955,8 @@ AcroForm::transformAnnotations( auto traverse_field = [&](QPDFObjectHandle& top_field) -> void { std::deque queue({top_field}); QPDFObjGen::set seen; - for (auto it = queue.begin(); it != queue.end(); ++it) { - auto& obj = *it; + for (; !queue.empty(); queue.pop_front()) { + auto& obj = queue.front(); if (seen.add(obj)) { Dictionary parent = obj["/Parent"]; if (parent.indirect()) {