summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_document_serialize.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-05-16 15:56:53 -0700
committerTom Sepez <tsepez@chromium.org>2016-05-16 15:56:53 -0700
commitd3743ea4e62e870724be26d423c90204c8639463 (patch)
treef54ee0cd640a9480341844dac86a4178892c94e5 /xfa/fxfa/parser/xfa_document_serialize.cpp
parentfa34e805fd03ba81bcfe1148cf96b24fe63b39a0 (diff)
downloadpdfium-d3743ea4e62e870724be26d423c90204c8639463.tar.xz
Revert "Replace Release() { delete this; } in fde_xml_imp.h"
This reverts commit fa34e805fd03ba81bcfe1148cf96b24fe63b39a0. Reason for revert: broke asan tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1982843002 .
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_serialize.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index 2e300505b3..ef85d0e266 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -6,8 +6,6 @@
#include "xfa/fxfa/parser/xfa_document_serialize.h"
-#include <memory>
-
#include "xfa/fde/xml/fde_xml_imp.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
@@ -24,26 +22,31 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument)
: m_pDocument(pDocument) {
ASSERT(m_pDocument);
}
-
FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
- std::unique_ptr<IXFA_Parser> pDataDocumentParser(
- IXFA_Parser::Create(m_pDocument));
+ IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument);
+ if (!pDataDocumentParser) {
+ return FALSE;
+ }
if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) !=
XFA_PARSESTATUS_Ready) {
+ pDataDocumentParser->Release();
return FALSE;
}
- if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done)
+ if (pDataDocumentParser->DoParse(NULL) < XFA_PARSESTATUS_Done) {
+ pDataDocumentParser->Release();
return FALSE;
-
+ }
CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode();
- if (!pImportDataRoot)
+ if (!pImportDataRoot) {
+ pDataDocumentParser->Release();
return FALSE;
-
+ }
CXFA_Node* pDataModel =
ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
- if (!pDataModel)
+ if (!pDataModel) {
+ pDataDocumentParser->Release();
return FALSE;
-
+ }
CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data));
if (pDataNode) {
pDataModel->RemoveChild(pDataNode);
@@ -63,9 +66,9 @@ FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
pDataModel->InsertChild(pImportDataRoot);
}
m_pDocument->DoDataRemerge(FALSE);
+ pDataDocumentParser->Release();
return TRUE;
}
-
CFX_WideString XFA_ExportEncodeAttribute(const CFX_WideString& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();