Switch from vector to deque for another CXFA_FFDocView members.
This make it easier to iterate through them safely.
BUG=chromium:949425
Change-Id: I14dd051f0ba5b25dd6e0fbcbae8d3afb42a243a9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/56770
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 022df5b..2c52c9c 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -597,7 +597,9 @@
}
void CXFA_FFDocView::RunBindItems() {
- for (auto* item : m_BindItems) {
+ while (!m_BindItems.empty()) {
+ CXFA_BindItems* item = m_BindItems.front();
+ m_BindItems.pop_front();
if (item->HasRemovedChildren())
continue;
@@ -656,7 +658,6 @@
pWidgetNode->InsertItem(wsLabel, wsValue, false);
}
}
- m_BindItems.clear();
}
void CXFA_FFDocView::SetChangeMark() {
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index 91aae15..3752527 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -122,7 +122,7 @@
UnownedPtr<CXFA_FFWidget> m_pFocusWidget;
std::deque<CXFA_Node*> m_ValidateNodes;
std::vector<CXFA_Node*> m_CalculateNodes;
- std::vector<CXFA_BindItems*> m_BindItems;
+ std::deque<CXFA_BindItems*> m_BindItems;
std::deque<CXFA_Node*> m_NewAddedNodes;
std::deque<CXFA_Node*> m_IndexChangedSubforms;
XFA_DOCVIEW_LAYOUTSTATUS m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_None;