Stop caching CXFA_FFWidgetHandler in CPDFSDK_Widget

This is currently an unowned pointer to a GC'd object at a layer
that is theoretically above anything that should know about GC.

Retrieving the handler involves chasing some pointers and a
virtual call, but no searching of containers is required, so
it should remain reasonably efficient without the cache.

Bug: pdfium:1563
Change-Id: I96d036b618f0b860465ae17ff59ed4db84ae3dd1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74130
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index c7724a27..80e50d6 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -99,13 +99,9 @@
   if (!pContext || !pContext->ContainsExtensionForegroundForm())
     return nullptr;
 
-  if (!m_pWidgetHandler) {
-    CXFA_FFDocView* pDocView =
-        static_cast<CPDFXFA_Context*>(pContext)->GetXFADocView();
-    if (pDocView)
-      m_pWidgetHandler = pDocView->GetWidgetHandler();
-  }
-  return m_pWidgetHandler.Get();
+  CXFA_FFDocView* pDocView =
+      static_cast<CPDFXFA_Context*>(pContext)->GetXFADocView();
+  return pDocView ? pDocView->GetWidgetHandler() : nullptr;
 }
 
 static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index 56ce8c8..1deb804 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -142,10 +142,6 @@
   bool m_bAppModified = false;
   uint32_t m_nAppearanceAge = 0;
   uint32_t m_nValueAge = 0;
-
-#ifdef PDF_ENABLE_XFA
-  mutable UnownedPtr<CXFA_FFWidgetHandler> m_pWidgetHandler;
-#endif  // PDF_ENABLE_XFA
 };
 
 inline CPDFSDK_Widget* ToCPDFSDKWidget(CPDFSDK_Annot* pAnnot) {