summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_listbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller/cffl_listbox.cpp')
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.cpp15
1 files changed, 4 insertions, 11 deletions
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();
}