summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_edit.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-15 14:35:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-15 18:45:55 +0000
commit022d13b85408beb400ce703bb5c59736adea208f (patch)
tree30051ba1dc335cbc71d191ec9843b727b0550fb7 /fpdfsdk/pwl/cpwl_edit.cpp
parent574756152de82613a71bb206d9fd50906e20f817 (diff)
downloadpdfium-022d13b85408beb400ce703bb5c59736adea208f.tar.xz
Add ObservedPtrs to KillFocus path
This is to prevent use after free issues due to these calls causing reloads of content that have the side of effect of destroying windows. BUG=chromium:760455 Change-Id: I3f3947be8b32964783abf5577a24ba6a713b3476 Reviewed-on: https://pdfium-review.googlesource.com/14150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_edit.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index a6f6f2ac86..4558e432ac 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -340,14 +340,26 @@ void CPWL_Edit::OnSetFocus() {
}
void CPWL_Edit::OnKillFocus() {
+ ObservedPtr observed_ptr = ObservedPtr(this);
CPWL_ScrollBar* pScroll = GetVScrollBar();
if (pScroll && pScroll->IsVisible()) {
pScroll->SetVisible(false);
+ if (!observed_ptr)
+ return;
+
Move(m_rcOldWindow, true, true);
}
+ if (!observed_ptr)
+ return;
m_pEdit->SelectNone();
+ if (!observed_ptr)
+ return;
+
SetCaret(false, CFX_PointF(), CFX_PointF());
+ if (!observed_ptr)
+ return;
+
SetCharSet(FX_CHARSET_ANSI);
m_bFocus = false;
}