summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-25 15:53:57 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-25 23:07:41 +0000
commitd0409afc6a994a3e24043b8a96c83c022bcaa189 (patch)
tree15fa78b8a601ec97fc8bee39f8e56590c37babe3 /fpdfsdk
parent2eddb665763f3e089d4c210d2a011d112683f3ea (diff)
downloadpdfium-d0409afc6a994a3e24043b8a96c83c022bcaa189.tar.xz
Mass conversion of remaining class members (non-xfa)
Change-Id: I8365ba80e3395d59a3cf35dbd9d9162e86e712e3 Reviewed-on: https://pdfium-review.googlesource.com/5970 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cba_annotiterator.h3
-rw-r--r--fpdfsdk/cpdfsdk_annot.h5
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp8
-rw-r--r--fpdfsdk/cpdfsdk_widget.h5
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.h6
-rw-r--r--fpdfsdk/cpdfsdk_xfawidget.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_xfawidget.h10
-rw-r--r--fpdfsdk/formfiller/cffl_checkbox.cpp2
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp6
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp14
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h6
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.cpp8
-rw-r--r--fpdfsdk/formfiller/cffl_radiobutton.cpp2
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp23
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp5
-rw-r--r--fpdfsdk/fpdfdoc_unittest.cpp48
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp2
-rw-r--r--fpdfsdk/fxedit/fxet_edit.h21
-rw-r--r--fpdfsdk/fxedit/fxet_list.cpp2
-rw-r--r--fpdfsdk/fxedit/fxet_list.h5
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.h6
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.h10
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h2
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.h9
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.h4
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.h7
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp13
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.h7
30 files changed, 127 insertions, 130 deletions
diff --git a/fpdfsdk/cba_annotiterator.h b/fpdfsdk/cba_annotiterator.h
index 5cbe8e3d57..36eacd91c0 100644
--- a/fpdfsdk/cba_annotiterator.h
+++ b/fpdfsdk/cba_annotiterator.h
@@ -10,6 +10,7 @@
#include <vector>
#include "core/fpdfdoc/cpdf_annot.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
@@ -37,7 +38,7 @@ class CBA_AnnotIterator {
std::vector<size_t>* aSelect);
TabOrder m_eTabOrder;
- CPDFSDK_PageView* m_pPageView;
+ CFX_UnownedPtr<CPDFSDK_PageView> m_pPageView;
CPDF_Annot::Subtype m_nAnnotSubtype;
std::vector<CPDFSDK_Annot*> m_Annots;
};
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h
index 1053c00c13..abcdc2ebae 100644
--- a/fpdfsdk/cpdfsdk_annot.h
+++ b/fpdfsdk/cpdfsdk_annot.h
@@ -11,6 +11,7 @@
#include "core/fpdfdoc/cpdf_annot.h"
#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fxcrt/cfx_observable.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/fsdk_common.h"
@@ -52,13 +53,13 @@ class CPDFSDK_Annot : public CFX_Observable<CPDFSDK_Annot> {
#endif // PDF_ENABLE_XFA
void SetPage(CPDFSDK_PageView* pPageView);
- CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
+ CPDFSDK_PageView* GetPageView() const { return m_pPageView.Get(); }
bool IsSelected();
void SetSelected(bool bSelected);
protected:
- CPDFSDK_PageView* m_pPageView;
+ CFX_UnownedPtr<CPDFSDK_PageView> m_pPageView;
bool m_bSelected;
};
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index a1cd8c7ce4..7d9357adb9 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -88,9 +88,8 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const {
m_hMixXFAWidget = pDocView->GetWidgetByName(sName, nullptr);
}
}
- return m_hMixXFAWidget;
+ return m_hMixXFAWidget.Get();
}
-
return nullptr;
}
@@ -113,10 +112,11 @@ CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
return nullptr;
if (!m_pWidgetHandler) {
- if (CXFA_FFDocView* pDocView = pContext->GetXFADocView())
+ CXFA_FFDocView* pDocView = pContext->GetXFADocView();
+ if (pDocView)
m_pWidgetHandler = pDocView->GetWidgetHandler();
}
- return m_pWidgetHandler;
+ return m_pWidgetHandler.Get();
}
static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index a5e5b702dc..fe8d015123 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -12,6 +12,7 @@
#include "core/fpdfdoc/cpdf_aaction.h"
#include "core/fpdfdoc/cpdf_action.h"
#include "core/fpdfdoc/cpdf_annot.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "fpdfsdk/cpdfsdk_baannot.h"
@@ -166,8 +167,8 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
int32_t m_nValueAge;
#ifdef PDF_ENABLE_XFA
- mutable CXFA_FFWidget* m_hMixXFAWidget;
- mutable CXFA_FFWidgetHandler* m_pWidgetHandler;
+ mutable CFX_UnownedPtr<CXFA_FFWidget> m_hMixXFAWidget;
+ mutable CFX_UnownedPtr<CXFA_FFWidgetHandler> m_pWidgetHandler;
#endif // PDF_ENABLE_XFA
};
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index a772471418..4e8c9ef480 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -100,11 +100,13 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
void SetFormFiller(CFFL_InteractiveFormFiller* pFiller) {
m_pFormFiller = pFiller;
}
- CFFL_InteractiveFormFiller* GetFormFiller() { return m_pFormFiller; }
+ CFFL_InteractiveFormFiller* GetFormFiller() const {
+ return m_pFormFiller.Get();
+ }
private:
CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
- CFFL_InteractiveFormFiller* m_pFormFiller;
+ CFX_UnownedPtr<CFFL_InteractiveFormFiller> m_pFormFiller;
};
#endif // FPDFSDK_CPDFSDK_WIDGETHANDLER_H_
diff --git a/fpdfsdk/cpdfsdk_xfawidget.cpp b/fpdfsdk/cpdfsdk_xfawidget.cpp
index 902ff2a2e8..af08023ef8 100644
--- a/fpdfsdk/cpdfsdk_xfawidget.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidget.cpp
@@ -16,12 +16,14 @@ CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot,
m_pInterForm(pInterForm),
m_hXFAWidget(pAnnot) {}
+CPDFSDK_XFAWidget::~CPDFSDK_XFAWidget() {}
+
bool CPDFSDK_XFAWidget::IsXFAField() {
return true;
}
CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const {
- return m_hXFAWidget;
+ return m_hXFAWidget.Get();
}
CPDF_Annot::Subtype CPDFSDK_XFAWidget::GetAnnotSubtype() const {
diff --git a/fpdfsdk/cpdfsdk_xfawidget.h b/fpdfsdk/cpdfsdk_xfawidget.h
index 9d0be75f13..42448b804f 100644
--- a/fpdfsdk/cpdfsdk_xfawidget.h
+++ b/fpdfsdk/cpdfsdk_xfawidget.h
@@ -7,6 +7,7 @@
#ifndef FPDFSDK_CPDFSDK_XFAWIDGET_H_
#define FPDFSDK_CPDFSDK_XFAWIDGET_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "fpdfsdk/cpdfsdk_annot.h"
@@ -20,18 +21,19 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot,
CPDFSDK_PageView* pPageView,
CPDFSDK_InterForm* pInterForm);
- ~CPDFSDK_XFAWidget() override {}
+ ~CPDFSDK_XFAWidget() override;
+ // CPDFSDK_Annot:
bool IsXFAField() override;
CXFA_FFWidget* GetXFAWidget() const override;
CPDF_Annot::Subtype GetAnnotSubtype() const override;
CFX_FloatRect GetRect() const override;
- CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; }
+ CPDFSDK_InterForm* GetInterForm() const { return m_pInterForm.Get(); }
private:
- CPDFSDK_InterForm* m_pInterForm;
- CXFA_FFWidget* m_hXFAWidget;
+ CFX_UnownedPtr<CPDFSDK_InterForm> m_pInterForm;
+ CFX_UnownedPtr<CXFA_FFWidget> m_hXFAWidget;
};
#endif // FPDFSDK_CPDFSDK_XFAWIDGET_H_
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index c233c136c1..323dcf4f91 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -48,7 +48,7 @@ bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot,
bool bReset = false;
bool bExit = false;
- CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget);
+ CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
&pObserved, pPageView, bReset, bExit, nFlags);
if (!pObserved) {
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 1f2491fe95..7887593b15 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -38,8 +38,10 @@ PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() {
if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)
cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT;
- if (!m_pFontMap)
- m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(m_pWidget, GetSystemHandler());
+ if (!m_pFontMap) {
+ m_pFontMap =
+ pdfium::MakeUnique<CBA_FontMap>(m_pWidget.Get(), GetSystemHandler());
+ }
cp.pFontMap = m_pFontMap.get();
cp.pFocusHandler = this;
return cp;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 947c495f19..2bc240fc2e 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -356,16 +356,14 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView,
}
} else {
PWL_CREATEPARAM cp = GetCreateParam();
- cp.pAttachedWidget.Reset(m_pWidget);
+ cp.pAttachedWidget.Reset(m_pWidget.Get());
CFFL_PrivateData* pPrivateData = new CFFL_PrivateData;
- pPrivateData->pWidget = m_pWidget;
+ pPrivateData->pWidget = m_pWidget.Get();
pPrivateData->pPageView = pPageView;
pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge();
pPrivateData->nValueAge = 0;
-
cp.pAttachedData = pPrivateData;
-
pWnd = NewPDFWindow(cp, pPageView);
m_Maps[pPageView] = pWnd;
}
@@ -506,7 +504,7 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) {
bool bExit = false;
CFFL_InteractiveFormFiller* pFormFiller =
m_pFormFillEnv->GetInteractiveFormFiller();
- CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget);
+ CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag);
if (!pObserved || bExit)
return true;
@@ -522,11 +520,11 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) {
return true;
}
SaveData(pPageView);
- pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag);
+ pFormFiller->OnCalculate(m_pWidget.Get(), pPageView, bExit, nFlag);
if (bExit)
return true;
- pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag);
+ pFormFiller->OnFormat(m_pWidget.Get(), pPageView, bExit, nFlag);
}
return true;
}
@@ -582,7 +580,7 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView,
bool bDestroyPDFWindow) {
m_bValid = false;
- InvalidateRect(GetViewBBox(pPageView, m_pWidget));
+ InvalidateRect(GetViewBBox(pPageView, m_pWidget.Get()));
if (bDestroyPDFWindow)
DestroyPDFWindow(pPageView);
}
diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h
index f9a155be86..bbb1e4b21b 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.h
+++ b/fpdfsdk/formfiller/cffl_formfiller.h
@@ -140,7 +140,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
void SetChangeMark();
virtual void InvalidateRect(const FX_RECT& rect);
- CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; }
+ CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot.Get(); }
protected:
using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>;
@@ -154,8 +154,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
void DestroyWindows();
CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
- CPDFSDK_Widget* m_pWidget;
- CPDFSDK_Annot* m_pAnnot;
+ CFX_UnownedPtr<CPDFSDK_Widget> m_pWidget;
+ CFX_UnownedPtr<CPDFSDK_Annot> m_pAnnot;
bool m_bValid;
CFFL_PageView2PDFWindow m_Maps;
CFX_PointF m_ptOldPos;
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index 556e0e17d7..399e3902b1 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -25,12 +25,9 @@ CFFL_ListBox::~CFFL_ListBox() {}
PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() {
PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
-
uint32_t dwFieldFlag = m_pWidget->GetFieldFlags();
-
- if (dwFieldFlag & FIELDFLAG_MULTISELECT) {
+ if (dwFieldFlag & FIELDFLAG_MULTISELECT)
cp.dwFlags |= PLBS_MULTIPLESEL;
- }
cp.dwFlags |= PWS_VSCROLL;
@@ -39,10 +36,9 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() {
if (!m_pFontMap) {
m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(
- m_pWidget, m_pFormFillEnv->GetSysHandler());
+ m_pWidget.Get(), m_pFormFillEnv->GetSysHandler());
}
cp.pFontMap = m_pFontMap.get();
-
return cp;
}
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index e78160e5dc..68f5cb0d88 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -51,7 +51,7 @@ bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot,
bool bReset = false;
bool bExit = false;
- CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget);
+ CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
&pObserved, pPageView, bReset, bExit, nFlags);
if (!pObserved || bReset || bExit)
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 71fc9291dc..b874a51b8c 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -28,34 +28,25 @@ CFFL_TextField::~CFFL_TextField() {
PWL_CREATEPARAM CFFL_TextField::GetCreateParam() {
PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
-
int nFlags = m_pWidget->GetFieldFlags();
-
- if (nFlags & FIELDFLAG_PASSWORD) {
+ if (nFlags & FIELDFLAG_PASSWORD)
cp.dwFlags |= PES_PASSWORD;
- }
if (nFlags & FIELDFLAG_MULTILINE) {
cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;
-
- if (!(nFlags & FIELDFLAG_DONOTSCROLL)) {
+ if (!(nFlags & FIELDFLAG_DONOTSCROLL))
cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL;
- }
} else {
cp.dwFlags |= PES_CENTER;
-
- if (!(nFlags & FIELDFLAG_DONOTSCROLL)) {
+ if (!(nFlags & FIELDFLAG_DONOTSCROLL))
cp.dwFlags |= PES_AUTOSCROLL;
- }
}
- if (nFlags & FIELDFLAG_COMB) {
+ if (nFlags & FIELDFLAG_COMB)
cp.dwFlags |= PES_CHARARRAY;
- }
- if (nFlags & FIELDFLAG_RICHTEXT) {
+ if (nFlags & FIELDFLAG_RICHTEXT)
cp.dwFlags |= PES_RICH;
- }
cp.dwFlags |= PES_UNDO;
@@ -71,14 +62,12 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() {
cp.dwFlags |= PES_RIGHT;
break;
}
-
if (!m_pFontMap) {
m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(
- m_pWidget, m_pFormFillEnv->GetSysHandler());
+ m_pWidget.Get(), m_pFormFillEnv->GetSysHandler());
}
cp.pFontMap = m_pFontMap.get();
cp.pFocusHandler = this;
-
return cp;
}
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 1f73887532..28af1ac582 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -123,13 +123,12 @@ DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap() {
}
struct FPDF_SYSFONTINFO_DEFAULT : public FPDF_SYSFONTINFO {
- IFX_SystemFontInfo* m_pFontInfo;
+ CFX_UnownedPtr<IFX_SystemFontInfo> m_pFontInfo;
};
static void DefaultRelease(struct _FPDF_SYSFONTINFO* pThis) {
auto* pDefault = static_cast<FPDF_SYSFONTINFO_DEFAULT*>(pThis);
- // TODO(thestig): Should this be set to nullptr too?
- delete pDefault->m_pFontInfo;
+ delete pDefault->m_pFontInfo.Release();
}
static void DefaultEnumFonts(struct _FPDF_SYSFONTINFO* pThis, void* pMapper) {
diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp
index 449121d351..6409f70fe2 100644
--- a/fpdfsdk/fpdfdoc_unittest.cpp
+++ b/fpdfsdk/fpdfdoc_unittest.cpp
@@ -87,7 +87,7 @@ class PDFDocTest : public testing::Test {
protected:
std::unique_ptr<CPDF_TestPdfDocument> m_pDoc;
- CPDF_IndirectObjectHolder* m_pIndirectObjs;
+ CFX_UnownedPtr<CPDF_IndirectObjectHolder> m_pIndirectObjs;
std::unique_ptr<CPDF_Dictionary> m_pRootObj;
};
@@ -116,25 +116,25 @@ TEST_F(PDFDocTest, FindBookmark) {
auto bookmarks = CreateDictObjs(3);
bookmarks[1].obj->SetNewFor<CPDF_String>("Title", L"Chapter 1");
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs.Get(),
bookmarks[2].num);
bookmarks[2].obj->SetNewFor<CPDF_String>("Title", L"Chapter 2");
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("Prev", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("Prev", m_pIndirectObjs.Get(),
bookmarks[1].num);
bookmarks[0].obj->SetNewFor<CPDF_Name>("Type", "Outlines");
bookmarks[0].obj->SetNewFor<CPDF_Number>("Count", 2);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs.Get(),
bookmarks[1].num);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs.Get(),
bookmarks[2].num);
- m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs,
+ m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs.Get(),
bookmarks[0].num);
// Title with no match.
@@ -159,25 +159,25 @@ TEST_F(PDFDocTest, FindBookmark) {
auto bookmarks = CreateDictObjs(3);
bookmarks[1].obj->SetNewFor<CPDF_String>("Title", L"Chapter 1");
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs.Get(),
bookmarks[2].num);
bookmarks[2].obj->SetNewFor<CPDF_String>("Title", L"Chapter 2");
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[1].num);
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs.Get(),
bookmarks[1].num);
bookmarks[0].obj->SetNewFor<CPDF_Name>("Type", "Outlines");
bookmarks[0].obj->SetNewFor<CPDF_Number>("Count", 2);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs.Get(),
bookmarks[1].num);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs.Get(),
bookmarks[2].num);
- m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs,
+ m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs.Get(),
bookmarks[0].num);
// Title with no match.
@@ -194,31 +194,31 @@ TEST_F(PDFDocTest, FindBookmark) {
auto bookmarks = CreateDictObjs(4);
bookmarks[1].obj->SetNewFor<CPDF_String>("Title", L"Chapter 1");
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[1].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs,
+ bookmarks[1].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs.Get(),
bookmarks[2].num);
bookmarks[2].obj->SetNewFor<CPDF_String>("Title", L"Chapter 2");
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[2].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs,
+ bookmarks[2].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs.Get(),
bookmarks[3].num);
bookmarks[3].obj->SetNewFor<CPDF_String>("Title", L"Chapter 3");
- bookmarks[3].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs,
+ bookmarks[3].obj->SetNewFor<CPDF_Reference>("Parent", m_pIndirectObjs.Get(),
bookmarks[0].num);
- bookmarks[3].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs,
+ bookmarks[3].obj->SetNewFor<CPDF_Reference>("Next", m_pIndirectObjs.Get(),
bookmarks[1].num);
bookmarks[0].obj->SetNewFor<CPDF_Name>("Type", "Outlines");
bookmarks[0].obj->SetNewFor<CPDF_Number>("Count", 2);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("First", m_pIndirectObjs.Get(),
bookmarks[1].num);
- bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs,
+ bookmarks[0].obj->SetNewFor<CPDF_Reference>("Last", m_pIndirectObjs.Get(),
bookmarks[2].num);
- m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs,
+ m_pRootObj->SetNewFor<CPDF_Reference>("Outlines", m_pIndirectObjs.Get(),
bookmarks[0].num);
// Title with no match.
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index cf4fdc3d91..0e86562044 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -145,7 +145,7 @@ CFX_Edit_Provider::CFX_Edit_Provider(IPVT_FontMap* pFontMap)
CFX_Edit_Provider::~CFX_Edit_Provider() {}
-IPVT_FontMap* CFX_Edit_Provider::GetFontMap() {
+IPVT_FontMap* CFX_Edit_Provider::GetFontMap() const {
return m_pFontMap;
}
diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h
index ebc326f5a9..01759aaba9 100644
--- a/fpdfsdk/fxedit/fxet_edit.h
+++ b/fpdfsdk/fxedit/fxet_edit.h
@@ -13,6 +13,7 @@
#include "core/fpdfdoc/cpvt_secprops.h"
#include "core/fpdfdoc/cpvt_wordprops.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/fxedit/fx_edit.h"
class CFFL_FormFiller;
@@ -158,7 +159,7 @@ class CFXEU_InsertWord : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
@@ -181,7 +182,7 @@ class CFXEU_InsertReturn : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
@@ -205,7 +206,7 @@ class CFXEU_Backspace : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
@@ -232,7 +233,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
@@ -255,7 +256,7 @@ class CFXEU_Clear : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordRange m_wrSel;
CFX_WideString m_swText;
@@ -275,7 +276,7 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem {
void Undo() override;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
@@ -449,8 +450,8 @@ class CFX_Edit {
private:
std::unique_ptr<CPDF_VariableText> m_pVT;
- CPWL_EditCtrl* m_pNotify;
- CPWL_Edit* m_pOprNotify;
+ CFX_UnownedPtr<CPWL_EditCtrl> m_pNotify;
+ CFX_UnownedPtr<CPWL_Edit> m_pOprNotify;
std::unique_ptr<CFX_Edit_Provider> m_pVTProvider;
CPVT_WordPlace m_wpCaret;
CPVT_WordPlace m_wpOldCaret;
@@ -485,7 +486,7 @@ class CFX_Edit_Iterator {
const CPVT_WordPlace& GetAt() const;
private:
- CFX_Edit* m_pEdit;
+ CFX_UnownedPtr<CFX_Edit> m_pEdit;
CPDF_VariableText::Iterator* m_pVTIterator;
};
@@ -494,7 +495,7 @@ class CFX_Edit_Provider : public CPDF_VariableText::Provider {
explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap);
~CFX_Edit_Provider() override;
- IPVT_FontMap* GetFontMap();
+ IPVT_FontMap* GetFontMap() const;
// CPDF_VariableText::Provider:
int32_t GetCharWidth(int32_t nFontIndex, uint16_t word) override;
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index c8fef948af..a3badf32fb 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -590,7 +590,7 @@ void CFX_ListCtrl::SetFontSize(float fFontSize) {
void CFX_ListCtrl::AddItem(const CFX_WideString& str) {
auto pListItem = pdfium::MakeUnique<CFX_ListItem>();
- pListItem->SetFontMap(m_pFontMap);
+ pListItem->SetFontMap(m_pFontMap.Get());
pListItem->SetFontSize(m_fFontSize);
pListItem->SetText(str);
m_ListItems.push_back(std::move(pListItem));
diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h
index cd6e2ddeff..b4b0a56c1e 100644
--- a/fpdfsdk/fxedit/fxet_list.h
+++ b/fpdfsdk/fxedit/fxet_list.h
@@ -11,6 +11,7 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "fpdfsdk/fxedit/fx_edit.h"
@@ -263,7 +264,7 @@ class CFX_ListCtrl : protected CFX_ListContainer {
void SetItemSelect(int32_t nItemIndex, bool bSelected);
int32_t GetLastSelected() const;
- CPWL_List_Notify* m_pNotify;
+ CFX_UnownedPtr<CPWL_List_Notify> m_pNotify;
bool m_bNotifyFlag;
CFX_PointF m_ptScrollPos;
CPLST_Select m_aSelItems; // for multiple
@@ -273,7 +274,7 @@ class CFX_ListCtrl : protected CFX_ListContainer {
int32_t m_nCaretIndex; // for multiple
std::vector<std::unique_ptr<CFX_ListItem>> m_ListItems;
float m_fFontSize;
- IPVT_FontMap* m_pFontMap;
+ CFX_UnownedPtr<IPVT_FontMap> m_pFontMap;
bool m_bMultiple;
};
diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h
index 5dcb70b4c8..82d9d6a93b 100644
--- a/fpdfsdk/javascript/JS_EventHandler.h
+++ b/fpdfsdk/javascript/JS_EventHandler.h
@@ -172,7 +172,7 @@ class CJS_EventHandler {
CFX_WideString m_strTargetName;
CFX_WideString m_strSourceName;
- CFX_WideString* m_pWideStrChange;
+ CFX_UnownedPtr<CFX_WideString> m_pWideStrChange;
CFX_WideString m_WideStrChangeDu;
CFX_WideString m_WideStrChangeEx;
int m_nCommitKey;
@@ -184,12 +184,12 @@ class CJS_EventHandler {
int* m_pISelStart;
int m_nSelStartDu;
bool m_bWillCommit;
- CFX_WideString* m_pValue;
+ CFX_UnownedPtr<CFX_WideString> m_pValue;
bool m_bFieldFull;
bool* m_pbRc;
bool m_bRcDu;
- CPDF_Bookmark* m_pTargetBookMark;
+ CFX_UnownedPtr<CPDF_Bookmark> m_pTargetBookMark;
CPDFSDK_FormFillEnvironment::ObservedPtr m_pTargetFormFillEnv;
CPDFSDK_Annot::ObservedPtr m_pTargetAnnot;
};
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.h b/fpdfsdk/pdfwindow/PWL_ComboBox.h
index 0dfb3bd86b..27cdb61b1a 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.h
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.h
@@ -52,7 +52,7 @@ class CPWL_ComboBox : public CPWL_Wnd {
CPWL_ComboBox();
~CPWL_ComboBox() override;
- CPWL_Edit* GetEdit() const { return m_pEdit; }
+ CPWL_Edit* GetEdit() const { return m_pEdit.Get(); }
// CPWL_Wnd:
CFX_ByteString GetClassName() const override;
@@ -93,14 +93,14 @@ class CPWL_ComboBox : public CPWL_Wnd {
void CreateListBox(const PWL_CREATEPARAM& cp);
void SetPopup(bool bPopup);
- CPWL_CBEdit* m_pEdit;
- CPWL_CBButton* m_pButton;
- CPWL_CBListBox* m_pList;
+ CFX_UnownedPtr<CPWL_CBEdit> m_pEdit;
+ CFX_UnownedPtr<CPWL_CBButton> m_pButton;
+ CFX_UnownedPtr<CPWL_CBListBox> m_pList;
bool m_bPopup;
CFX_FloatRect m_rcOldWindow;
int32_t m_nPopupWhere;
int32_t m_nSelectItem;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
};
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
index bd3799141a..82c1f19629 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -134,7 +134,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place,
bool bLatin,
bool bArabic) const;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
bool m_bFocus;
CFX_FloatRect m_rcOldWindow;
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 3ae7244552..e1397bff0c 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -55,8 +55,8 @@ void CPWL_Image::SetPDFStream(CPDF_Stream* pStream) {
m_pPDFStream = pStream;
}
-CPDF_Stream* CPWL_Image::GetPDFStream() {
- return m_pPDFStream;
+CPDF_Stream* CPWL_Image::GetPDFStream() const {
+ return m_pPDFStream.Get();
}
void CPWL_Image::GetImageSize(float& fWidth, float& fHeight) {
@@ -114,8 +114,8 @@ CPWL_Icon::CPWL_Icon() : m_pIconFit(nullptr) {}
CPWL_Icon::~CPWL_Icon() {}
-CPDF_IconFit* CPWL_Icon::GetIconFit() {
- return m_pIconFit;
+CPDF_IconFit* CPWL_Icon::GetIconFit() const {
+ return m_pIconFit.Get();
}
int32_t CPWL_Icon::GetScaleMethod() {
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.h b/fpdfsdk/pdfwindow/PWL_Icon.h
index 49ac1f3f3d..c5d116be69 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.h
+++ b/fpdfsdk/pdfwindow/PWL_Icon.h
@@ -7,6 +7,7 @@
#ifndef FPDFSDK_PDFWINDOW_PWL_ICON_H_
#define FPDFSDK_PDFWINDOW_PWL_ICON_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
@@ -19,7 +20,7 @@ class CPWL_Image : public CPWL_Wnd {
virtual void GetScale(float& fHScale, float& fVScale);
virtual void GetImageOffset(float& x, float& y);
- virtual CPDF_Stream* GetPDFStream();
+ virtual CPDF_Stream* GetPDFStream() const;
public:
void SetPDFStream(CPDF_Stream* pStream);
@@ -29,7 +30,7 @@ class CPWL_Image : public CPWL_Wnd {
void SetImageAlias(const char* sImageAlias);
protected:
- CPDF_Stream* m_pPDFStream;
+ CFX_UnownedPtr<CPDF_Stream> m_pPDFStream;
CFX_ByteString m_sImageAlias;
};
@@ -38,7 +39,7 @@ class CPWL_Icon : public CPWL_Image {
CPWL_Icon();
~CPWL_Icon() override;
- virtual CPDF_IconFit* GetIconFit();
+ virtual CPDF_IconFit* GetIconFit() const;
// CPWL_Image
void GetScale(float& fHScale, float& fVScale) override;
@@ -51,7 +52,7 @@ class CPWL_Icon : public CPWL_Image {
void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }
private:
- CPDF_IconFit* m_pIconFit;
+ CFX_UnownedPtr<CPDF_IconFit> m_pIconFit;
};
#endif // FPDFSDK_PDFWINDOW_PWL_ICON_H_
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index b682959426..09487c3314 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -36,7 +36,8 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
Info.fSmallStep = fSmallStep;
Info.fBigStep = fBigStep;
- m_pList->OnNotify(m_pList, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info);
+ m_pList->OnNotify(m_pList.Get(), PNM_SETSCROLLINFO, SBT_VSCROLL,
+ reinterpret_cast<intptr_t>(&Info));
if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
@@ -55,7 +56,8 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
}
void CPWL_List_Notify::IOnSetScrollPosY(float fy) {
- m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
+ m_pList->OnNotify(m_pList.Get(), PNM_SETSCROLLPOS, SBT_VSCROLL,
+ reinterpret_cast<intptr_t>(&fy));
}
void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) {
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h
index 0de9c91195..75d23bb7c6 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.h
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.h
@@ -41,7 +41,7 @@ class CPWL_List_Notify {
const CPVT_WordPlace& place);
private:
- CPWL_ListBox* m_pList;
+ CFX_UnownedPtr<CPWL_ListBox> m_pList;
};
class CPWL_ListBox : public CPWL_Wnd {
@@ -109,7 +109,7 @@ class CPWL_ListBox : public CPWL_Wnd {
std::unique_ptr<CPWL_List_Notify> m_pListNotify;
bool m_bMouseDown;
bool m_bHoverSel;
- IPWL_Filler_Notify* m_pFillerNotify;
+ CFX_UnownedPtr<IPWL_Filler_Notify> m_pFillerNotify;
private:
CFX_UnownedPtr<CFFL_FormFiller> m_pFormFiller;
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
index 50b0801ca3..41df6550e0 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h
@@ -7,6 +7,7 @@
#ifndef FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
#define FPDFSDK_PDFWINDOW_PWL_SCROLLBAR_H_
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
class CPWL_SBButton;
@@ -169,9 +170,9 @@ class CPWL_ScrollBar : public CPWL_Wnd {
PWL_SCROLLBAR_TYPE m_sbType;
PWL_SCROLL_INFO m_OriginInfo;
- CPWL_SBButton* m_pMinButton;
- CPWL_SBButton* m_pMaxButton;
- CPWL_SBButton* m_pPosButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pMinButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pMaxButton;
+ CFX_UnownedPtr<CPWL_SBButton> m_pPosButton;
PWL_SCROLL_PRIVATEDATA m_sData;
bool m_bMouseDown;
bool m_bMinOrMax;
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 5523c59317..1db79b4bc7 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -180,9 +180,9 @@ class CPWL_MsgControl {
private:
std::vector<CPWL_Wnd*> m_aMousePath;
std::vector<CPWL_Wnd*> m_aKeyboardPath;
- CPWL_Wnd* m_pCreatedWnd;
- CPWL_Wnd* m_pMainMouseWnd;
- CPWL_Wnd* m_pMainKeyboardWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pCreatedWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pMainMouseWnd;
+ CFX_UnownedPtr<CPWL_Wnd> m_pMainKeyboardWnd;
};
CPWL_Wnd::CPWL_Wnd()
@@ -594,10 +594,7 @@ void* CPWL_Wnd::GetAttachedData() const {
}
CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const {
- if (HasFlag(PWS_VSCROLL))
- return m_pVScrollBar;
-
- return nullptr;
+ return HasFlag(PWS_VSCROLL) ? m_pVScrollBar.Get() : nullptr;
}
void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM& cp) {
@@ -885,7 +882,7 @@ void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) {
const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
CPWL_MsgControl* pMsgCtrl = GetMsgControl();
- return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd : nullptr;
+ return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd.Get() : nullptr;
}
void CPWL_Wnd::EnableWindow(bool bEnable) {
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index ded003c31b..59de290653 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -12,6 +12,7 @@
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fxcrt/cfx_observable.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "fpdfsdk/cfx_systemhandler.h"
#include "fpdfsdk/cpdfsdk_widget.h"
@@ -224,8 +225,8 @@ class CPWL_Timer {
private:
int32_t m_nTimerID;
- CPWL_TimerHandler* m_pAttached;
- CFX_SystemHandler* m_pSystemHandler;
+ CFX_UnownedPtr<CPWL_TimerHandler> m_pAttached;
+ CFX_UnownedPtr<CFX_SystemHandler> m_pSystemHandler;
};
class CPWL_TimerHandler {
@@ -398,7 +399,7 @@ class CPWL_Wnd : public CPWL_TimerHandler {
std::vector<CPWL_Wnd*> m_Children;
PWL_CREATEPARAM m_sPrivateParam;
- CPWL_ScrollBar* m_pVScrollBar;
+ CFX_UnownedPtr<CPWL_ScrollBar> m_pVScrollBar;
CFX_FloatRect m_rcWindow;
CFX_FloatRect m_rcClip;
bool m_bCreated;