From 77417ec9e1312a75407f8ab46dd46f777a1742f1 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 19 Jul 2017 16:46:22 -0700 Subject: Make CPWL_Wnd classes be observable. This is another case where JS may lead to destruction of an object far away from where we are holding it. Bug: 737023 Change-Id: I994d5425184b8c00b5cfaeb95dbb5032a6e09edb Reviewed-on: https://pdfium-review.googlesource.com/8350 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fpdfsdk/formfiller/cffl_listbox.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'fpdfsdk/formfiller/cffl_listbox.cpp') diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index 11206e2b87..4a6264d6dc 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -189,17 +189,10 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, SaveState(pPageView); DestroyPDFWindow(pPageView); - - CPWL_Wnd* pRet = nullptr; - - if (bRestoreValue) { + if (bRestoreValue) RestoreState(pPageView); - pRet = GetPDFWindow(pPageView, false); - } else { - pRet = GetPDFWindow(pPageView, true); - } - - m_pWidget->UpdateField(); - return pRet; + CPWL_Wnd::ObservedPtr pRet(GetPDFWindow(pPageView, !bRestoreValue)); + m_pWidget->UpdateField(); // May invoke JS, invalidating pRet. + return pRet.Get(); } -- cgit v1.2.3