Chromium Code Reviews| Index: xfa/fxfa/app/xfa_ffdoc.cpp |
| diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp |
| index f33e4e0585868226f5f796b330255a3021a6d06d..d1994256a80b5812ac7d3ae14e2b8178ad6036b3 100644 |
| --- a/xfa/fxfa/app/xfa_ffdoc.cpp |
| +++ b/xfa/fxfa/app/xfa_ffdoc.cpp |
| @@ -7,6 +7,7 @@ |
| #include "xfa/fxfa/include/xfa_ffdoc.h" |
| #include <algorithm> |
| +#include <memory> |
| #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| @@ -145,10 +146,11 @@ int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { |
| if (!OpenDoc(pPDFDocument)) { |
| return XFA_PARSESTATUS_SyntaxErr; |
| } |
| - IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument, TRUE); |
| - if (!pParser) { |
| + std::unique_ptr<IXFA_Parser> pParser( |
| + IXFA_Parser::Create(m_pDocument, TRUE)); |
| + if (!pParser) |
| return XFA_PARSESTATUS_SyntaxErr; |
| - } |
| + |
| CXFA_Node* pRootNode = NULL; |
| if (pParser->StartParse(m_pStream) == XFA_PARSESTATUS_Ready && |
| pParser->DoParse(NULL) == XFA_PARSESTATUS_Done) { |
| @@ -160,8 +162,6 @@ int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { |
| } else { |
| iStatus = XFA_PARSESTATUS_StatusErr; |
| } |
| - pParser->Release(); |
| - pParser = NULL; |
| } |
| return iStatus; |
| } |
| @@ -265,7 +265,7 @@ FX_BOOL CXFA_FFDoc::CloseDoc() { |
| m_TypeToDocViewMap.clear(); |
| if (m_pDocument) { |
| - m_pDocument->GetParser()->Release(); |
| + delete m_pDocument->GetParser(); |
|
Lei Zhang
2016/05/16 20:38:08
Feels a bit weird to leave |m_pDocument| with a da
Tom Sepez
2016/05/16 21:29:06
Yeah, ugh. Made this a method of the xfa doc.
|
| m_pDocument = nullptr; |
| } |