summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pwl/cpwl_edit.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index c71dbe4be0..0b74a1896e 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -331,16 +331,24 @@ bool CPWL_Edit::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) {
}
void CPWL_Edit::OnSetFocus() {
+ ObservedPtr observed_ptr(this);
SetEditCaret(true);
+ if (!observed_ptr)
+ return;
+
if (!IsReadOnly()) {
- if (CPWL_Wnd::FocusHandlerIface* pFocusHandler = GetFocusHandler())
+ if (CPWL_Wnd::FocusHandlerIface* pFocusHandler = GetFocusHandler()) {
pFocusHandler->OnSetFocus(this);
+ if (!observed_ptr)
+ return;
+ }
}
m_bFocus = true;
}
void CPWL_Edit::OnKillFocus() {
- ObservedPtr observed_ptr = ObservedPtr(this);
+ ObservedPtr observed_ptr(this);
+
CPWL_ScrollBar* pScroll = GetVScrollBar();
if (pScroll && pScroll->IsVisible()) {
pScroll->SetVisible(false);