diff options
author | tsepez <tsepez@chromium.org> | 2016-09-27 14:29:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-27 14:29:57 -0700 |
commit | f8074cefb2f8d947fa83d151bcbe080b485d6e6b (patch) | |
tree | fe97655234318181a58827666576010abb745b18 /fpdfsdk/include/cpdfsdk_pageview.h | |
parent | ec7a9455c15b2cebb75a6036c8636beb601e543a (diff) | |
download | pdfium-f8074cefb2f8d947fa83d151bcbe080b485d6e6b.tar.xz |
Watch destruction of widgets around OnAAction() method.
We implemented the CFX_Observable mechanism for detecting
stale objects some time ago; now just use it in more places.
Change method signatures to required an ObservedPtr to
indicate that the callers are aware that the value may be
destroyed out from underneath them.
BUG=649659
Review-Url: https://codereview.chromium.org/2368403002
Diffstat (limited to 'fpdfsdk/include/cpdfsdk_pageview.h')
-rw-r--r-- | fpdfsdk/include/cpdfsdk_pageview.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fpdfsdk/include/cpdfsdk_pageview.h b/fpdfsdk/include/cpdfsdk_pageview.h index d22b6b48a0..2a54dffc30 100644 --- a/fpdfsdk/include/cpdfsdk_pageview.h +++ b/fpdfsdk/include/cpdfsdk_pageview.h @@ -12,6 +12,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fxcrt/include/fx_system.h" +#include "fpdfsdk/include/cpdfsdk_annot.h" #include "fpdfsdk/include/cpdfsdk_document.h" class CFX_RenderDevice; @@ -39,7 +40,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View { const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); CPDFSDK_Annot* GetFocusAnnot(); - void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, uint32_t nFlag = 0) { + void SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pSDKAnnot, + uint32_t nFlag = 0) { m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag); } FX_BOOL KillFocusAnnot(uint32_t nFlag = 0) { @@ -108,7 +110,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View { std::unique_ptr<CPDF_AnnotList> m_pAnnotList; std::vector<CPDFSDK_Annot*> m_fxAnnotArray; CPDFSDK_Document* const m_pSDKDoc; - CPDFSDK_Annot* m_CaptureWidget; + CPDFSDK_Annot::ObservedPtr m_pCaptureWidget; #ifndef PDF_ENABLE_XFA bool m_bOwnsPage; #endif // PDF_ENABLE_XFA |