dbaccess/source/ui/control/FieldDescControl.cxx      |   48 -------------------
 dbaccess/source/ui/inc/FieldDescControl.hxx          |    2 
 dbaccess/source/ui/tabledesign/TableFieldControl.cxx |    6 --
 dbaccess/source/ui/tabledesign/TableFieldControl.hxx |    2 
 4 files changed, 58 deletions(-)

New commits:
commit f368b81bfb741bd9a206a2a09d47b9ec38d35ae4
Author:     Neil Roberts <[email protected]>
AuthorDate: Thu Oct 23 19:23:05 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Oct 26 16:25:08 2025 +0100

    tdf#168970 Remove {OFieldDescControl,OTableFieldControl}::dispose
    
    The dispose methods were only called in the destructors of the these two
    classes so they didn’t work like a normal dispose method to break
    reference cycles. Other than that the only useful work they did was to
    hide all of the controls in OFieldDescControl. This turns out to be kind
    of dangerous because if one of the controls had the keyboard focus then
    it would end up sending the focus lost event which would in turn call an
    undefined pure virtual function and crash.
    
    This patch is needed to fix the crash when OFieldDescControl is used in
    the new table wizard and the copy table wizard. In that case we don’t
    need to try to flush the modifications because the new table is just
    discarded as if the dialog was cancelled when the window is closed.
    
    Change-Id: I56b585d2dcd5bbf2ee2f0d770a33a02685e60d0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192977
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx 
b/dbaccess/source/ui/control/FieldDescControl.cxx
index ba9d61d2c6fb..041b15c48b9c 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -82,54 +82,6 @@ OFieldDescControl::OFieldDescControl(weld::Container* pPage, 
OTableDesignHelpBar
 
 OFieldDescControl::~OFieldDescControl()
 {
-    dispose();
-}
-
-void OFieldDescControl::dispose()
-{
-    // Destroy children
-    DeactivateAggregate( tpDefault );
-    DeactivateAggregate( tpRequired );
-    DeactivateAggregate( tpTextLen );
-    DeactivateAggregate( tpNumType );
-    DeactivateAggregate( tpScale );
-    DeactivateAggregate( tpLength );
-    DeactivateAggregate( tpFormat );
-    DeactivateAggregate( tpAutoIncrement );
-    DeactivateAggregate( tpBoolDefault );
-    DeactivateAggregate( tpColumnName );
-    DeactivateAggregate( tpType );
-    DeactivateAggregate( tpAutoIncrementValue );
-    m_pHelp = nullptr;
-    m_pLastFocusWindow = nullptr;
-    m_pActFocusWindow = nullptr;
-    m_xDefaultText.reset();
-    m_xRequiredText.reset();
-    m_xAutoIncrementText.reset();
-    m_xTextLenText.reset();
-    m_xNumTypeText.reset();
-    m_xLengthText.reset();
-    m_xScaleText.reset();
-    m_xFormatText.reset();
-    m_xBoolDefaultText.reset();
-    m_xColumnNameText.reset();
-    m_xTypeText.reset();
-    m_xAutoIncrementValueText.reset();
-    m_xRequired.reset();
-    m_xNumType.reset();
-    m_xAutoIncrement.reset();
-    m_xDefault.reset();
-    m_xTextLen.reset();
-    m_xLength.reset();
-    m_xScale.reset();
-    m_xFormatSample.reset();
-    m_xBoolDefault.reset();
-    m_xColumnName.reset();
-    m_xType.reset();
-    m_xAutoIncrementValue.reset();
-    m_xFormat.reset();
-    m_xContainer.reset();
-    m_xBuilder.reset();
 }
 
 OUString OFieldDescControl::BoolStringPersistent(std::u16string_view 
rUIString) const
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx 
b/dbaccess/source/ui/inc/FieldDescControl.hxx
index f07191802374..1381fff2619a 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -123,8 +123,6 @@ namespace dbaui
 
         bool                IsFocusInEditableWidget() const;
 
-        void                dispose();
-
         // Call func on all of the controls or stop early if one of them 
returns true
         template <class Func> bool iterateControls(Func func)
         {
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx 
b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
index fac580c2586a..5aeee355ab5b 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx
@@ -39,14 +39,8 @@ OTableFieldControl::OTableFieldControl(weld::Container* 
pParent, OTableDesignHel
 {
 }
 
-void OTableFieldControl::dispose()
-{
-    m_xView.reset();
-}
-
 OTableFieldControl::~OTableFieldControl()
 {
-    dispose();
 }
 
 void OTableFieldControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx 
b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
index 4a232f86c3d8..83fdb9d0d9dc 100644
--- a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx
@@ -33,8 +33,6 @@ namespace dbaui
 
         OTableEditorCtrl*   GetCtrl() const;
 
-        void dispose();
-
     protected:
         virtual void        ActivateAggregate( EControlType eType ) override;
         virtual void        DeactivateAggregate( EControlType eType ) override;

Reply via email to