summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_baannothandler.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-27 14:29:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-27 14:29:57 -0700
commitf8074cefb2f8d947fa83d151bcbe080b485d6e6b (patch)
treefe97655234318181a58827666576010abb745b18 /fpdfsdk/cpdfsdk_baannothandler.cpp
parentec7a9455c15b2cebb75a6036c8636beb601e543a (diff)
downloadpdfium-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/cpdfsdk_baannothandler.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 1422c75f49..8131d6f19b 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -79,75 +79,79 @@ void CPDFSDK_BAAnnotHandler::OnDelete(CPDFSDK_Annot* pAnnot) {}
void CPDFSDK_BAAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {}
void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
- CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot);
+ CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get());
pBAAnnot->SetOpenState(true);
UpdateAnnotRects(pPageView, pBAAnnot);
}
void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
- CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot);
+ CPDFSDK_BAAnnot* pBAAnnot = static_cast<CPDFSDK_BAAnnot*>(pAnnot->Get());
pBAAnnot->SetOpenState(false);
UpdateAnnotRects(pPageView, pBAAnnot);
}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDown(
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
return FALSE;
}
FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
return FALSE;
}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_BAAnnotHandler::OnLButtonDblClk(
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
return FALSE;
}
FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
return FALSE;
}
FX_BOOL CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) {
return FALSE;
}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDown(
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
return FALSE;
}
FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
return FALSE;
}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
- uint32_t nFlags,
- const CFX_FloatPoint& point) {
+FX_BOOL CPDFSDK_BAAnnotHandler::OnRButtonDblClk(
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlags,
+ const CFX_FloatPoint& point) {
return FALSE;
}
@@ -177,19 +181,20 @@ void CPDFSDK_BAAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {}
void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
+FX_BOOL CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
return FALSE;
}
-FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
+FX_BOOL CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
return FALSE;
}
#ifdef PDF_ENABLE_XFA
-FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) {
+FX_BOOL CPDFSDK_BAAnnotHandler::OnXFAChangedFocus(
+ CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) {
return TRUE;
}
#endif // PDF_ENABLE_XFA