summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_caret.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pwl/cpwl_caret.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_caret.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp
index b1040bc2e3..99d2e2ece7 100644
--- a/fpdfsdk/pwl/cpwl_caret.cpp
+++ b/fpdfsdk/pwl/cpwl_caret.cpp
@@ -59,6 +59,8 @@ void CPWL_Caret::TimerProc() {
} else {
m_bFlash = !m_bFlash;
InvalidateRect(nullptr);
+ // Note, |this| may no longer be viable at this point. If more work needs
+ // to be done, add an observer.
}
}
@@ -77,15 +79,24 @@ void CPWL_Caret::SetCaret(bool bVisible,
m_ptFoot = ptFoot;
m_bFlash = true;
Move(m_rcInvalid, false, true);
+ // Note, |this| may no longer be viable at this point. If more work
+ // needs to be done, add an observer.
}
} else {
m_ptHead = ptHead;
m_ptFoot = ptFoot;
EndTimer();
BeginTimer(PWL_CARET_FLASHINTERVAL);
+
+ ObservedPtr observer(this);
CPWL_Wnd::SetVisible(true);
+ if (!observer)
+ return;
+
m_bFlash = true;
Move(m_rcInvalid, false, true);
+ // Note, |this| may no longer be viable at this point. If more work needs
+ // to be done, add an observer.
}
} else {
m_ptHead = CFX_PointF();
@@ -94,6 +105,8 @@ void CPWL_Caret::SetCaret(bool bVisible,
if (IsVisible()) {
EndTimer();
CPWL_Wnd::SetVisible(false);
+ // Note, |this| may no longer be viable at this point. If more work needs
+ // to be done, add an observer.
}
}
}
@@ -111,4 +124,6 @@ void CPWL_Caret::InvalidateRect(CFX_FloatRect* pRect) {
} else {
CPWL_Wnd::InvalidateRect(pRect);
}
+ // Note, |this| may no longer be viable at this point. If more work needs
+ // to be done, add an observer.
}