summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp2
-rw-r--r--xfa/fde/cfde_txtedtpage.h2
-rw-r--r--xfa/fde/cfde_txtedttextset.cpp4
-rw-r--r--xfa/fde/cfde_txtedttextset.h2
-rw-r--r--xfa/fde/css/cfde_cssstyleselector.cpp2
-rw-r--r--xfa/fde/css/cfde_cssstyleselector.h2
-rw-r--r--xfa/fwl/cfwl_app.h4
-rw-r--r--xfa/fwl/cfwl_combobox.cpp21
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp10
-rw-r--r--xfa/fwl/cfwl_edit.cpp8
-rw-r--r--xfa/fwl/cfwl_listbox.cpp8
-rw-r--r--xfa/fwl/cfwl_widget.h6
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h2
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp8
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp16
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp6
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.h2
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp4
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp12
-rw-r--r--xfa/fxfa/app/xfa_fwltheme.h2
-rw-r--r--xfa/fxfa/cxfa_ffapp.h4
-rw-r--r--xfa/fxfa/cxfa_ffpageview.cpp2
-rw-r--r--xfa/fxfa/cxfa_ffpageview.h6
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffwidget.h2
-rw-r--r--xfa/fxfa/cxfa_pdffontmgr.h2
-rw-r--r--xfa/fxfa/fm2js/cxfa_fm2jscontext.h4
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.h3
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.h4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_layoutprocessor.h3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp12
-rw-r--r--xfa/fxfa/parser/cxfa_nodelocale.h2
-rw-r--r--xfa/fxfa/parser/cxfa_object.h4
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.h4
40 files changed, 105 insertions, 93 deletions
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index f3127e7708..4f1e8fb7f0 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -38,7 +38,7 @@ CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex)
CFDE_TxtEdtPage::~CFDE_TxtEdtPage() {}
CFDE_TxtEdtEngine* CFDE_TxtEdtPage::GetEngine() const {
- return m_pEditEngine;
+ return m_pEditEngine.Get();
}
FDE_VISUALOBJTYPE CFDE_TxtEdtPage::GetType() {
diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h
index c715c45062..aa88801ba7 100644
--- a/xfa/fde/cfde_txtedtpage.h
+++ b/xfa/fde/cfde_txtedtpage.h
@@ -59,7 +59,7 @@ class CFDE_TxtEdtPage : public IFDE_VisualSet {
std::unique_ptr<IFX_CharIter> m_pIter;
std::unique_ptr<CFDE_TxtEdtTextSet> m_pTextSet;
- CFDE_TxtEdtEngine* const m_pEditEngine;
+ CFX_UnownedPtr<CFDE_TxtEdtEngine> const m_pEditEngine;
std::deque<FDE_TEXTEDITPIECE> m_Pieces;
CFDE_TxtEdtParag* m_pBgnParag;
CFDE_TxtEdtParag* m_pEndParag;
diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp
index dd68d42618..0785754e1f 100644
--- a/xfa/fde/cfde_txtedttextset.cpp
+++ b/xfa/fde/cfde_txtedttextset.cpp
@@ -60,7 +60,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece,
CFX_TxtBreak* pBreak = pEngine->GetTextBreak();
uint32_t dwLayoutStyle = pBreak->GetLayoutStyles();
FX_TXTRUN tr;
- tr.pAccess = m_pPage;
+ tr.pAccess = m_pPage.Get();
tr.pIdentity = &piece;
tr.iLength = nLength;
tr.pFont = pTextParams->pFont;
@@ -82,7 +82,7 @@ std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects(
const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles();
FX_TXTRUN tr;
- tr.pAccess = m_pPage;
+ tr.pAccess = m_pPage.Get();
tr.pIdentity = pPiece;
tr.iLength = pPiece->nCount;
tr.pFont = pTextParams->pFont;
diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h
index 8e4c4d01bf..29303373da 100644
--- a/xfa/fde/cfde_txtedttextset.h
+++ b/xfa/fde/cfde_txtedttextset.h
@@ -34,7 +34,7 @@ class CFDE_TxtEdtTextSet : public IFDE_VisualSet {
bool bBBox);
private:
- CFDE_TxtEdtPage* const m_pPage;
+ CFX_UnownedPtr<CFDE_TxtEdtPage> const m_pPage;
};
#endif // XFA_FDE_CFDE_TXTEDTTEXTSET_H_
diff --git a/xfa/fde/css/cfde_cssstyleselector.cpp b/xfa/fde/css/cfde_cssstyleselector.cpp
index 024c8a86e2..461192e976 100644
--- a/xfa/fde/css/cfde_cssstyleselector.cpp
+++ b/xfa/fde/css/cfde_cssstyleselector.cpp
@@ -48,7 +48,7 @@ void CFDE_CSSStyleSelector::SetUAStyleSheet(
void CFDE_CSSStyleSelector::UpdateStyleIndex() {
m_UARules.Clear();
- m_UARules.AddRulesFrom(m_UAStyles.get(), m_pFontMgr);
+ m_UARules.AddRulesFrom(m_UAStyles.get(), m_pFontMgr.Get());
}
std::vector<const CFDE_CSSDeclaration*>
diff --git a/xfa/fde/css/cfde_cssstyleselector.h b/xfa/fde/css/cfde_cssstyleselector.h
index 0783e72541..6f40c968c7 100644
--- a/xfa/fde/css/cfde_cssstyleselector.h
+++ b/xfa/fde/css/cfde_cssstyleselector.h
@@ -78,7 +78,7 @@ class CFDE_CSSStyleSelector {
uint32_t ToTextDecoration(const CFX_RetainPtr<CFDE_CSSValueList>& pList);
FDE_CSSFontVariant ToFontVariant(FDE_CSSPropertyValue eValue);
- CFGAS_FontMgr* const m_pFontMgr;
+ CFX_UnownedPtr<CFGAS_FontMgr> const m_pFontMgr;
float m_fDefFontSize;
std::unique_ptr<CFDE_CSSStyleSheet> m_UAStyles;
CFDE_CSSRuleCollection m_UARules;
diff --git a/xfa/fwl/cfwl_app.h b/xfa/fwl/cfwl_app.h
index c2779e8a25..04f140f451 100644
--- a/xfa/fwl/cfwl_app.h
+++ b/xfa/fwl/cfwl_app.h
@@ -32,12 +32,12 @@ class CFWL_App {
explicit CFWL_App(CXFA_FFApp* pAdapter);
~CFWL_App();
- CXFA_FFApp* GetAdapterNative() const { return m_pAdapterNative; }
+ CXFA_FFApp* GetAdapterNative() const { return m_pAdapterNative.Get(); }
CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr.get(); }
CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); }
private:
- CXFA_FFApp* const m_pAdapterNative;
+ CFX_UnownedPtr<CXFA_FFApp> const m_pAdapterNative;
std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr;
std::unique_ptr<CFWL_NoteDriver> m_pNoteDriver;
};
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index b5931d1c04..ba72d3d2b2 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -49,12 +49,12 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app)
auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
- m_pListBox =
- pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
+ m_pListBox = pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp.Get(),
+ std::move(prop), this);
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(
- m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
+ m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
m_pEdit->SetOuter(this);
}
if (m_pEdit)
@@ -92,7 +92,8 @@ void CFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown);
if (bAddDropDown && !m_pEdit) {
m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(
- m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
+ m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(),
+ nullptr);
m_pEdit->SetOuter(this);
m_pEdit->SetParent(this);
} else if (bRemoveDropDown && m_pEdit) {
@@ -496,8 +497,8 @@ void CFWL_ComboBox::InitProxyForm() {
// TODO(dsinclair): Does this leak? I don't see a delete, but I'm not sure
// if the SetParent call is going to transfer ownership.
- m_pComboBoxProxy = new CFWL_ComboBoxProxy(this, m_pOwnerApp, std::move(prop),
- m_pListBox.get());
+ m_pComboBoxProxy = new CFWL_ComboBoxProxy(this, m_pOwnerApp.Get(),
+ std::move(prop), m_pListBox.get());
m_pListBox->SetParent(m_pComboBoxProxy);
}
@@ -510,8 +511,8 @@ void CFWL_ComboBox::DisForm_InitComboList() {
prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pListBox =
- pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
+ m_pListBox = pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp.Get(),
+ std::move(prop), this);
}
void CFWL_ComboBox::DisForm_InitComboEdit() {
@@ -522,8 +523,8 @@ void CFWL_ComboBox::DisForm_InitComboEdit() {
prop->m_pParent = this;
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit =
- pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp, std::move(prop), this);
+ m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(m_pOwnerApp.Get(),
+ std::move(prop), this);
m_pEdit->SetOuter(this);
}
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index e1d3a748d6..a49785e987 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -40,8 +40,8 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
monthProp->m_pParent = this;
monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(
- new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this));
+ m_pMonthCal = pdfium::MakeUnique<CFWL_MonthCalendar>(
+ m_pOwnerApp.Get(), std::move(monthProp), this);
m_pMonthCal->SetWidgetRect(
CFX_RectF(0, 0, m_pMonthCal->GetAutosizedWidgetRect().Size()));
@@ -50,7 +50,7 @@ CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
editProp->m_pParent = this;
editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp,
+ m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp.Get(),
std::move(editProp), this);
RegisterEventTarget(m_pMonthCal.get());
RegisterEventTarget(m_pEdit.get());
@@ -332,8 +332,8 @@ void CFWL_DateTimePicker::InitProxyForm() {
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pOwner = this;
- m_pForm = pdfium::MakeUnique<CFWL_FormProxy>(m_pOwnerApp, std::move(prop),
- m_pMonthCal.get());
+ m_pForm = pdfium::MakeUnique<CFWL_FormProxy>(
+ m_pOwnerApp.Get(), std::move(prop), m_pMonthCal.get());
m_pMonthCal->SetParent(m_pForm.get());
}
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 28948cca21..eff76ffabf 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -1063,8 +1063,8 @@ void CFWL_Edit::InitVerticalScrollBar() {
prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
prop->m_pParent = this;
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pVertScrollBar =
- pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this);
+ m_pVertScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(),
+ std::move(prop), this);
}
void CFWL_Edit::InitHorizontalScrollBar() {
@@ -1076,8 +1076,8 @@ void CFWL_Edit::InitHorizontalScrollBar() {
prop->m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
prop->m_pParent = this;
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pHorzScrollBar =
- pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this);
+ m_pHorzScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(),
+ std::move(prop), this);
}
void CFWL_Edit::ShowCaret(CFX_RectF* pRect) {
diff --git a/xfa/fwl/cfwl_listbox.cpp b/xfa/fwl/cfwl_listbox.cpp
index 9d9bf72f4c..0fd43efa08 100644
--- a/xfa/fwl/cfwl_listbox.cpp
+++ b/xfa/fwl/cfwl_listbox.cpp
@@ -630,8 +630,8 @@ void CFWL_ListBox::InitVerticalScrollBar() {
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pParent = this;
prop->m_pThemeProvider = m_pScrollBarTP;
- m_pVertScrollBar =
- pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this);
+ m_pVertScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(),
+ std::move(prop), this);
}
void CFWL_ListBox::InitHorizontalScrollBar() {
@@ -643,8 +643,8 @@ void CFWL_ListBox::InitHorizontalScrollBar() {
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pParent = this;
prop->m_pThemeProvider = m_pScrollBarTP;
- m_pHorzScrollBar =
- pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp, std::move(prop), this);
+ m_pHorzScrollBar = pdfium::MakeUnique<CFWL_ScrollBar>(m_pOwnerApp.Get(),
+ std::move(prop), this);
}
bool CFWL_ListBox::IsShowScrollBar(bool bVert) {
diff --git a/xfa/fwl/cfwl_widget.h b/xfa/fwl/cfwl_widget.h
index dd8fb5654b..9bcbf55cbc 100644
--- a/xfa/fwl/cfwl_widget.h
+++ b/xfa/fwl/cfwl_widget.h
@@ -104,7 +104,7 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
return m_pDelegate ? m_pDelegate.Get() : this;
}
- const CFWL_App* GetOwnerApp() const { return m_pOwnerApp; }
+ const CFWL_App* GetOwnerApp() const { return m_pOwnerApp.Get(); }
uint32_t GetEventKey() const { return m_nEventKey; }
void SetEventKey(uint32_t key) { m_nEventKey = key; }
@@ -148,8 +148,8 @@ class CFWL_Widget : public IFWL_WidgetDelegate {
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
- const CFWL_App* const m_pOwnerApp;
- CFWL_WidgetMgr* const m_pWidgetMgr;
+ CFX_UnownedPtr<const CFWL_App> const m_pOwnerApp;
+ CFX_UnownedPtr<CFWL_WidgetMgr> const m_pWidgetMgr;
std::unique_ptr<CFWL_WidgetProperties> m_pProperties;
CFWL_Widget* m_pOuter;
int32_t m_iLock;
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index c3dca31d76..4c12e707f6 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -116,7 +116,7 @@ class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate {
uint32_t m_dwCapability;
std::map<CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem;
- CXFA_FWLAdapterWidgetMgr* const m_pAdapter;
+ CFX_UnownedPtr<CXFA_FWLAdapterWidgetMgr> const m_pAdapter;
#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
CFX_RectF m_rtScreen;
#endif
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 9837e0aa7b..76531cecdd 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -320,7 +320,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) {
m_pDocView->AddCalculateWidgetAcc(pFFExclGroup);
pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
}
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
} else {
SetFWLCheckState(m_pDataAcc->GetCheckState());
@@ -329,7 +329,7 @@ void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) {
eParam.m_pTarget = pFFExclGroup;
pFFExclGroup->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
}
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
break;
}
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index b191f838ce..e24e7f77b7 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -166,7 +166,7 @@ bool CXFA_FFListBox::UpdateFWLData() {
void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw);
auto* pListBox = ToListBox(m_pNormalWidget.get());
@@ -342,7 +342,7 @@ bool CXFA_FFComboBox::IsDataChanged() {
void CXFA_FFComboBox::FWLEventSelChange(CXFA_EventParam* pParam) {
pParam->m_eType = XFA_EVENT_Change;
- pParam->m_pTarget = m_pDataAcc;
+ pParam->m_pTarget = m_pDataAcc.Get();
pParam->m_wsNewText = ToComboBox(m_pNormalWidget.get())->GetEditText();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, pParam);
}
@@ -514,14 +514,14 @@ void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) {
void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_PreOpen;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PreOpen, &eParam);
}
void CXFA_FFComboBox::OnPostOpen(CFWL_Widget* pWidget) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_PostOpen;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PostOpen, &eParam);
}
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 186f573182..425ba30843 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -639,14 +639,14 @@ bool CXFA_FFField::ProcessCommittedData() {
return false;
m_pDocView->SetChangeMark();
- m_pDocView->AddValidateWidget(m_pDataAcc);
+ m_pDocView->AddValidateWidget(m_pDataAcc.Get());
return true;
}
int32_t CXFA_FFField::CalculateOverride() {
CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup();
if (!pAcc)
- return CalculateWidgetAcc(m_pDataAcc);
+ return CalculateWidgetAcc(m_pDataAcc.Get());
if (CalculateWidgetAcc(pAcc) == 0)
return 0;
@@ -745,26 +745,26 @@ void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {}
void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) {
switch (pEvent->GetType()) {
case CFWL_Event::Type::Mouse: {
- CFWL_EventMouse* event = (CFWL_EventMouse*)pEvent;
+ CFWL_EventMouse* event = static_cast<CFWL_EventMouse*>(pEvent);
if (event->m_dwCmd == FWL_MouseCommand::Enter) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseEnter;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseEnter, &eParam);
} else if (event->m_dwCmd == FWL_MouseCommand::Leave) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseExit;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseExit, &eParam);
} else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonDown) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseDown;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseDown, &eParam);
} else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonUp) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_MouseUp;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseUp, &eParam);
}
break;
@@ -772,7 +772,7 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) {
case CFWL_Event::Type::Click: {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Click;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam);
break;
}
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index 475fa09eda..b07b625538 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -251,7 +251,7 @@ void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) {
}
CXFA_FFDoc* CXFA_FFNotify::GetHDOC() {
- return m_pDoc;
+ return m_pDoc.Get();
}
IXFA_DocEnvironment* CXFA_FFNotify::GetDocEnvironment() const {
@@ -468,7 +468,7 @@ void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) {
!(pDocView->m_bInLayoutStatus) &&
(pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
if (bLayoutReady)
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
+ m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc.Get());
}
void CXFA_FFNotify::OnChildRemoved() {
@@ -480,7 +480,7 @@ void CXFA_FFNotify::OnChildRemoved() {
!(pDocView->m_bInLayoutStatus) &&
(pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
if (bLayoutReady)
- m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc);
+ m_pDoc->GetDocEnvironment()->SetChangeMark(m_pDoc.Get());
}
void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h
index c002ed4c15..930d3b6a90 100644
--- a/xfa/fxfa/app/xfa_ffnotify.h
+++ b/xfa/fxfa/app/xfa_ffnotify.h
@@ -71,7 +71,7 @@ class CXFA_FFNotify {
void SetFocusWidgetNode(CXFA_Node* pNode);
private:
- CXFA_FFDoc* const m_pDoc;
+ CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc;
};
#endif // XFA_FXFA_APP_XFA_FFNOTIFY_H_
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 9d9cf070b4..b596996b6c 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -141,7 +141,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() {
if (m_pDataAcc->GetButtonRollover(wsRollover, bRichText)) {
if (!m_pRollProvider) {
m_pRollProvider = pdfium::MakeUnique<CXFA_TextProvider>(
- m_pDataAcc, XFA_TEXTPROVIDERTYPE_Rollover);
+ m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Rollover);
}
m_pRolloverTextLayout =
pdfium::MakeUnique<CXFA_TextLayout>(m_pRollProvider.get());
@@ -150,7 +150,7 @@ void CXFA_FFPushButton::LoadHighlightCaption() {
if (m_pDataAcc->GetButtonDown(wsDown, bRichText)) {
if (!m_pDownProvider) {
m_pDownProvider = pdfium::MakeUnique<CXFA_TextProvider>(
- m_pDataAcc, XFA_TEXTPROVIDERTYPE_Down);
+ m_pDataAcc.Get(), XFA_TEXTPROVIDERTYPE_Down);
}
m_pDownTextLayout =
pdfium::MakeUnique<CXFA_TextLayout>(m_pDownProvider.get());
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index a1030f538a..41305efcc8 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -307,7 +307,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
eParam.m_wsChange = wsChanged;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
eParam.m_wsPrevText = wsPrevText;
CFWL_Edit* pEdit = static_cast<CFWL_Edit*>(m_pNormalWidget.get());
if (m_pDataAcc->GetUIType() == XFA_Element::DateTimeEdit) {
@@ -328,7 +328,7 @@ void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget,
void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Full;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam);
}
@@ -450,7 +450,7 @@ bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget,
m_pDataAcc->GetFracDigits(iFracs);
CFX_WideString wsFormat;
- CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc);
+ CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pDataAcc.Get());
widgetValue.GetNumbericFormat(wsFormat, iLeads, iFracs);
return widgetValue.ValidateNumericTemp(wsText, wsFormat,
m_pDataAcc->GetLocal());
@@ -545,7 +545,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() {
switch (value.GetChildValueClassID()) {
case XFA_Element::Date: {
if (!wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
CFX_DateTime date = lcValue.GetDate();
if (date.IsSet())
pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
@@ -647,7 +647,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() {
auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get());
normalWidget->SetEditText(wsText);
if (IsFocused() && !wsText.IsEmpty()) {
- CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
+ CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc.Get());
CFX_DateTime date = lcValue.GetDate();
if (lcValue.IsValid()) {
if (date.IsSet())
@@ -690,7 +690,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
}
diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h
index 33ea8e80a5..7563c69ed9 100644
--- a/xfa/fxfa/app/xfa_fwltheme.h
+++ b/xfa/fxfa/app/xfa_fwltheme.h
@@ -61,7 +61,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider {
std::unique_ptr<CFDE_TextOut> m_pTextOut;
CFX_RetainPtr<CFGAS_GEFont> m_pCalendarFont;
CFX_WideString m_wsResource;
- CXFA_FFApp* const m_pApp;
+ CFX_UnownedPtr<CXFA_FFApp> const m_pApp;
CFX_RectF m_Rect;
};
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index 1ae2073d82..0da4e79173 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -40,7 +40,7 @@ class CXFA_FFApp {
CFGAS_FontMgr* GetFDEFontMgr();
CXFA_FWLTheme* GetFWLTheme();
- IXFA_AppProvider* GetAppProvider() const { return m_pProvider; }
+ IXFA_AppProvider* GetAppProvider() const { return m_pProvider.Get(); }
const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
IFWL_AdapterTimerMgr* GetTimerMgr() const;
CXFA_FontMgr* GetXFAFontMgr() const;
@@ -52,7 +52,7 @@ class CXFA_FFApp {
private:
std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler;
- IXFA_AppProvider* const m_pProvider;
+ CFX_UnownedPtr<IXFA_AppProvider> const m_pProvider;
// The fonts stored in the font manager may have been created by the default
// font manager. The GEFont::LoadFont call takes the manager as a param and
diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp
index d027a83ce1..c83ffaea7e 100644
--- a/xfa/fxfa/cxfa_ffpageview.cpp
+++ b/xfa/fxfa/cxfa_ffpageview.cpp
@@ -115,7 +115,7 @@ CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
CXFA_FFPageView::~CXFA_FFPageView() {}
CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
- return m_pDocView;
+ return m_pDocView.Get();
}
CFX_RectF CXFA_FFPageView::GetPageViewRect() const {
diff --git a/xfa/fxfa/cxfa_ffpageview.h b/xfa/fxfa/cxfa_ffpageview.h
index 01409f3403..f2451fbd26 100644
--- a/xfa/fxfa/cxfa_ffpageview.h
+++ b/xfa/fxfa/cxfa_ffpageview.h
@@ -31,7 +31,7 @@ class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
uint32_t dwWidgetFilter);
protected:
- CXFA_FFDocView* const m_pDocView;
+ CFX_UnownedPtr<CXFA_FFDocView> const m_pDocView;
};
using CXFA_LayoutItemIterator =
@@ -68,11 +68,11 @@ class CXFA_TabParam {
void AppendTabParam(CXFA_TabParam* pParam);
void ClearChildren();
- CXFA_FFWidget* GetWidget() { return m_pWidget; }
+ CXFA_FFWidget* GetWidget() const { return m_pWidget.Get(); }
const std::vector<CXFA_FFWidget*>& GetChildren() const { return m_Children; }
private:
- CXFA_FFWidget* const m_pWidget;
+ CFX_UnownedPtr<CXFA_FFWidget> const m_pWidget;
std::vector<CXFA_FFWidget*> m_Children;
};
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index 78bc5ed598..9de99255ab 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -98,7 +98,7 @@ CFX_RectF CXFA_FFWidget::GetBBox(uint32_t dwStatus, bool bDrawFocus) {
}
CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() {
- return m_pDataAcc;
+ return m_pDataAcc.Get();
}
bool CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) {
@@ -238,7 +238,7 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) {
m_dwStatus |= XFA_WidgetStatus_Focused;
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Enter;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam);
return true;
}
@@ -490,7 +490,7 @@ void CXFA_FFWidget::EventKillFocus() {
}
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Exit;
- eParam.m_pTarget = m_pDataAcc;
+ eParam.m_pTarget = m_pDataAcc.Get();
m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam);
}
bool CXFA_FFWidget::IsButtonDown() {
diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h
index 2ca27c1303..b7bb123bda 100644
--- a/xfa/fxfa/cxfa_ffwidget.h
+++ b/xfa/fxfa/cxfa_ffwidget.h
@@ -185,7 +185,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
CXFA_FFDocView* m_pDocView;
CXFA_FFPageView* m_pPageView;
- CXFA_WidgetAcc* const m_pDataAcc;
+ CFX_UnownedPtr<CXFA_WidgetAcc> const m_pDataAcc;
mutable CFX_RectF m_rtWidget;
};
diff --git a/xfa/fxfa/cxfa_pdffontmgr.h b/xfa/fxfa/cxfa_pdffontmgr.h
index d0a824067a..df8ab28e08 100644
--- a/xfa/fxfa/cxfa_pdffontmgr.h
+++ b/xfa/fxfa/cxfa_pdffontmgr.h
@@ -50,7 +50,7 @@ class CXFA_PDFFontMgr : public CFX_Observable<CXFA_PDFFontMgr> {
const CFX_ByteString& bsDRFontName,
bool bStrictMatch);
- CXFA_FFDoc* const m_pDoc;
+ CFX_UnownedPtr<CXFA_FFDoc> const m_pDoc;
std::map<CFX_RetainPtr<CFGAS_GEFont>, CPDF_Font*> m_FDE2PDFFont;
std::map<CFX_ByteString, CFX_RetainPtr<CFGAS_GEFont>> m_FontMap;
};
diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
index 0de3cc74b5..63fc0f42bd 100644
--- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
+++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.h
@@ -434,7 +434,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
private:
v8::Isolate* GetScriptRuntime() const { return m_pIsolate; }
- CXFA_Document* GetDocument() const { return m_pDocument; }
+ CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
void ThrowNoDefaultPropertyException(const CFX_ByteStringC& name) const;
void ThrowCompilerErrorException() const;
@@ -449,7 +449,7 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject {
v8::Isolate* m_pIsolate;
CFXJSE_Class* m_pFMClass;
std::unique_ptr<CFXJSE_Value> m_pValue;
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
};
#endif // XFA_FXFA_FM2JS_CXFA_FM2JSCONTEXT_H_
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index 693d4029a3..6e6a1086ff 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -368,7 +368,8 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
if (!pDocLayout)
return;
- auto pArrayNodeList = pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument);
+ auto pArrayNodeList =
+ pdfium::MakeUnique<CXFA_ArrayNodeList>(m_pDocument.Get());
pArrayNodeList->SetArrayNodeList(
GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea));
pArguments->GetReturnValue()->SetObject(
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index dda93a36fc..49a1f5857b 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -458,6 +458,8 @@ CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument)
ASSERT(m_pDocument);
}
+CXFA_DataExporter::~CXFA_DataExporter() {}
+
bool CXFA_DataExporter::Export(
const CFX_RetainPtr<IFX_SeekableStream>& pWrite) {
return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr);
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h
index cd949be964..4c0d90af9e 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.h
+++ b/xfa/fxfa/parser/cxfa_dataexporter.h
@@ -18,6 +18,7 @@ class CFX_SeekableStreamProxy;
class CXFA_DataExporter {
public:
explicit CXFA_DataExporter(CXFA_Document* pDocument);
+ ~CXFA_DataExporter();
bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite);
bool Export(const CFX_RetainPtr<IFX_SeekableStream>& pWrite,
@@ -31,7 +32,7 @@ class CXFA_DataExporter {
uint32_t dwFlag,
const char* pChecksum);
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
};
#endif // XFA_FXFA_PARSER_CXFA_DATAEXPORTER_H_
diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp
index d83b92b08d..e4ae3d0796 100644
--- a/xfa/fxfa/parser/cxfa_dataimporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp
@@ -22,10 +22,12 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument)
ASSERT(m_pDocument);
}
+CXFA_DataImporter::~CXFA_DataImporter() {}
+
bool CXFA_DataImporter::ImportData(
const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument) {
auto pDataDocumentParser =
- pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false);
+ pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false);
if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) !=
XFA_PARSESTATUS_Ready) {
return false;
diff --git a/xfa/fxfa/parser/cxfa_dataimporter.h b/xfa/fxfa/parser/cxfa_dataimporter.h
index e76475cd1e..d3af1de517 100644
--- a/xfa/fxfa/parser/cxfa_dataimporter.h
+++ b/xfa/fxfa/parser/cxfa_dataimporter.h
@@ -8,6 +8,7 @@
#define XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
class CXFA_Document;
@@ -16,11 +17,12 @@ class IFX_SeekableStream;
class CXFA_DataImporter {
public:
explicit CXFA_DataImporter(CXFA_Document* pDocument);
+ ~CXFA_DataImporter();
bool ImportData(const CFX_RetainPtr<IFX_SeekableStream>& pDataDocument);
private:
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
};
#endif // XFA_FXFA_PARSER_CXFA_DATAIMPORTER_H_
diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
index 0fbae9e368..765f8b2fe7 100644
--- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp
@@ -24,7 +24,7 @@ CXFA_LayoutProcessor::CXFA_LayoutProcessor(CXFA_Document* pDocument)
CXFA_LayoutProcessor::~CXFA_LayoutProcessor() {}
CXFA_Document* CXFA_LayoutProcessor::GetDocument() const {
- return m_pDocument;
+ return m_pDocument.Get();
}
int32_t CXFA_LayoutProcessor::StartLayout(bool bForceRestart) {
diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.h b/xfa/fxfa/parser/cxfa_layoutprocessor.h
index 5a48560f26..360a9df685 100644
--- a/xfa/fxfa/parser/cxfa_layoutprocessor.h
+++ b/xfa/fxfa/parser/cxfa_layoutprocessor.h
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_system.h"
class CXFA_ContainerLayoutItem;
@@ -44,7 +45,7 @@ class CXFA_LayoutProcessor {
private:
bool IsNeedLayout();
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
std::unique_ptr<CXFA_ItemLayoutProcessor> m_pRootItemLayoutProcessor;
std::unique_ptr<CXFA_LayoutPageMgr> m_pLayoutPageMgr;
std::vector<CXFA_Node*> m_rgChangedContainers;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index e7ec4cf890..2daa49e066 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1040,7 +1040,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
refNode = this;
pScriptContext->ResolveObjects(refNode, wsExpression.AsStringC(),
resoveNodeRS, dwFlag);
- CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument);
+ CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument.Get());
if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
for (CXFA_Object* pObject : resoveNodeRS.objects) {
if (pObject->IsNode())
@@ -1083,7 +1083,8 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue,
CFX_WideString wsMessage = L"Unable to set ";
FXJSE_ThrowMessage(wsMessage.UTF8Encode().AsStringC());
} else {
- CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this);
+ CXFA_AttachNodeList* pNodeList =
+ new CXFA_AttachNodeList(m_pDocument.Get(), this);
pValue->SetObject(pNodeList, pScriptContext->GetJseNormalClass());
}
}
@@ -1282,7 +1283,8 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
bIgnoreRoot = !!pArguments->GetInt32(1);
if (iLength >= 3)
bOverwrite = !!pArguments->GetInt32(2);
- auto pParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false);
+ auto pParser =
+ pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument.Get(), false);
if (!pParser)
return;
CFX_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression);
@@ -1524,7 +1526,7 @@ void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue,
void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {}
void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) {
- CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
+ CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get());
pArguments->GetReturnValue()->SetObject(
pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass());
}
@@ -3269,7 +3271,7 @@ void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) {
}
std::vector<CXFA_Node*> formItems;
- CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument);
+ CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument.Get());
pFormNodes->SetArrayNodeList(formItems);
pArguments->GetReturnValue()->SetObject(
pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass());
diff --git a/xfa/fxfa/parser/cxfa_nodelocale.h b/xfa/fxfa/parser/cxfa_nodelocale.h
index 2465650b47..e051bb6ac3 100644
--- a/xfa/fxfa/parser/cxfa_nodelocale.h
+++ b/xfa/fxfa/parser/cxfa_nodelocale.h
@@ -47,7 +47,7 @@ class CXFA_NodeLocale : public IFX_Locale {
int index,
bool bAbbr) const;
- CXFA_Node* const m_pLocale;
+ CFX_UnownedPtr<CXFA_Node> const m_pLocale;
};
#endif // XFA_FXFA_PARSER_CXFA_NODELOCALE_H_
diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h
index 9596453712..4f1850f14c 100644
--- a/xfa/fxfa/parser/cxfa_object.h
+++ b/xfa/fxfa/parser/cxfa_object.h
@@ -38,7 +38,7 @@ class CXFA_Object : public CFXJSE_HostObject {
const CFX_WideStringC& elementName);
~CXFA_Object() override;
- CXFA_Document* GetDocument() const { return m_pDocument; }
+ CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
XFA_ObjectType GetObjectType() const { return m_objectType; }
bool IsNode() const {
@@ -86,7 +86,7 @@ class CXFA_Object : public CFXJSE_HostObject {
protected:
void ThrowException(const wchar_t* str, ...) const;
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
const XFA_ObjectType m_objectType;
const XFA_Element m_elementType;
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index cf6467e240..49da63eee3 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -150,7 +150,7 @@ bool CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType,
if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) {
if (!m_FM2JSContext) {
m_FM2JSContext = pdfium::MakeUnique<CXFA_FM2JSContext>(
- m_pIsolate, m_JsContext.get(), m_pDocument);
+ m_pIsolate, m_JsContext.get(), m_pDocument.Get());
}
CFX_WideTextBuf wsJavaScript;
if (!CXFA_FM2JSContext::Translate(wsScript, &wsJavaScript)) {
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h
index d3a9609769..45e6897a4c 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.h
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.h
@@ -92,7 +92,7 @@ class CXFA_ScriptContext {
bool IsStrictScopeInJavaScript();
XFA_SCRIPTLANGTYPE GetType();
std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; }
- CXFA_Document* GetDocument() const { return m_pDocument; }
+ CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
static CXFA_Object* ToObject(CFXJSE_Value* pValue, CFXJSE_Class* pClass);
@@ -103,7 +103,7 @@ class CXFA_ScriptContext {
void DefineJsClass();
void RemoveBuiltInObjs(CFXJSE_Context* pContext) const;
- CXFA_Document* const m_pDocument;
+ CFX_UnownedPtr<CXFA_Document> const m_pDocument;
std::unique_ptr<CFXJSE_Context> m_JsContext;
v8::Isolate* m_pIsolate;
CFXJSE_Class* m_pJsClass;