Remove unreachable code in ~CFXA_Object().
Now that CXFA_Objects are all owned by the CXFA_NodeOwner, either
as lists or nodes, the IsBeingDestroyed() call will always be true,
since the node owner doesn't release objects prior to its deletion.
Change-Id: I21bdd88ab33e4ab6a1ec85663e33402414e6bbff
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71711
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fxfa/parser/cxfa_nodeowner.cpp b/xfa/fxfa/parser/cxfa_nodeowner.cpp
index b0e4de3..0cae85f 100644
--- a/xfa/fxfa/parser/cxfa_nodeowner.cpp
+++ b/xfa/fxfa/parser/cxfa_nodeowner.cpp
@@ -13,9 +13,7 @@
CXFA_NodeOwner::CXFA_NodeOwner() = default;
-CXFA_NodeOwner::~CXFA_NodeOwner() {
- is_being_destroyed_ = true;
-}
+CXFA_NodeOwner::~CXFA_NodeOwner() = default;
CXFA_Node* CXFA_NodeOwner::AddOwnedNode(std::unique_ptr<CXFA_Node> node) {
if (!node)
diff --git a/xfa/fxfa/parser/cxfa_nodeowner.h b/xfa/fxfa/parser/cxfa_nodeowner.h
index 8916366..efba10f 100644
--- a/xfa/fxfa/parser/cxfa_nodeowner.h
+++ b/xfa/fxfa/parser/cxfa_nodeowner.h
@@ -23,12 +23,9 @@
// Takes ownership of |list|, returns unowned pointer to it.
CXFA_List* AddOwnedList(std::unique_ptr<CXFA_List> list);
- bool IsBeingDestroyed() const { return is_being_destroyed_; }
-
protected:
CXFA_NodeOwner();
- bool is_being_destroyed_ = false;
std::vector<std::unique_ptr<CXFA_Node>> nodes_; // Must outlive |lists_|.
std::vector<std::unique_ptr<CXFA_List>> lists_;
};
diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp
index 175bee0..272e82b 100644
--- a/xfa/fxfa/parser/cxfa_object.cpp
+++ b/xfa/fxfa/parser/cxfa_object.cpp
@@ -30,10 +30,7 @@
m_elementNameHash(FX_HashCode_GetAsIfW(m_elementName, false)),
m_pJSObject(std::move(jsObject)) {}
-CXFA_Object::~CXFA_Object() {
- if (!GetDocument()->IsBeingDestroyed() && GetDocument()->HasScriptContext())
- GetDocument()->GetScriptContext()->RemoveJSBindingFromMap(this);
-}
+CXFA_Object::~CXFA_Object() = default;
WideString CXFA_Object::GetSOMExpression() {
CXFA_Node* pNode = AsNode();