Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: fpdfsdk/fpdfformfill.cpp

Issue 2397473006: Remove ownership of CPDFSDK_Document from CPDFXFA_Document (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/cpdfsdk_environment.h ('k') | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfformfill.cpp
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 6fea1af42b061aa14c1761b06003700674b22b6f..904a3c867e04897cbd48d0464c9a421d15073074 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -254,8 +254,7 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
CPDFSDK_Environment* pEnv = new CPDFSDK_Environment(pDocument, formInfo);
#ifdef PDF_ENABLE_XFA
- // Ownership of the SDKDocument is passed to the CPDFXFA_Document.
- pDocument->SetSDKDoc(pdfium::WrapUnique(pEnv->GetSDKDocument()));
+ pDocument->SetSDKDoc(pEnv->GetSDKDocument());
CPDFXFA_App::GetInstance()->AddFormFillEnv(pEnv);
#endif // PDF_ENABLE_XFA
@@ -271,10 +270,12 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
#ifdef PDF_ENABLE_XFA
CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pEnv);
-#else // PDF_ENABLE_XFA
+
+ // Reset the focused annotations and remove the SDK document from the
+ // XFA document.
if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) {
- pEnv->SetSDKDocument(nullptr);
- delete pSDKDoc;
+ pSDKDoc->ClearAllFocusedAnnots();
+ pSDKDoc->GetXFADocument()->SetSDKDoc(nullptr);
}
#endif // PDF_ENABLE_XFA
« no previous file with comments | « fpdfsdk/cpdfsdk_environment.h ('k') | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698