[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/Library_scui.mk sc/source

Stephan Bergmann sbergman at redhat.com
Thu Jan 21 23:37:56 PST 2016


 sc/Library_sc.mk                   |    1 +
 sc/Library_scui.mk                 |    1 -
 sc/inc/scabstdlg.hxx               |    3 ---
 sc/source/ui/attrdlg/scdlgfact.cxx |   13 -------------
 sc/source/ui/attrdlg/scdlgfact.hxx |    5 -----
 sc/source/ui/view/cellsh2.cxx      |   22 +++-------------------
 6 files changed, 4 insertions(+), 41 deletions(-)

New commits:
commit 60db0ded330f800306b9a829922bf389e1c0aa07
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 22 08:23:38 2016 +0100

    Move sc/source/ui/dbgui/validate.cxx from scui to sc
    
    8d1a24dae03690b576310e3539369916f31ac475 "Make virtual ~ScValidationDlg
    non-inline" caused the RTTI for ScValidationDlg to only be emitted in library
    scui instead of (weakly) wherever needed.  That causes UBSan to fail when it
    uses the RTTI in ScValidityRefChildWin::ScValidityRefChildWin
    (sc/source/ui/view/reffact.cxx, in library sc, to check that operations on
    VclPtr<ScValidationDlg> pDlg indeed operate on an ScValidationDlg object).
    
    The cleanest fix appears to be to move ScValidationDlg from scui to sc.  As
    Moggi put it on IRC, "that dialog should be in sc as it is a modeless dialog; no
    idea why it works for that dialog but all other modeless calc dialogs have to be
    in sc to avoid linker problems."
    
    One remaining question is whether it is save nowadays in ScCellShell::ExecuteDB
    (sc/source/ui/view/cellsh2.cxx) to clean up the ScValidationDlg pointed to by
    pDlg when that VclPtr<ScValidationDlg> variable goes out of scope, instead of
    doing the PostUserEvent(... DelayDeleteAbstractDialog) dance that was there
    before because "after end execute from !IsModalInputMode, it is safer to delay
    deleting."  Lets see.
    
    Change-Id: I3ecfd4fafc7b37b2f30e75974ece9b0a23311ef4

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 8304a9a..d082a6b 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -403,6 +403,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/ui/dbgui/PivotLayoutTreeListLabel \
     sc/source/ui/dbgui/PivotLayoutTreeList \
     sc/source/ui/dbgui/sfiltdlg \
+    sc/source/ui/dbgui/validate \
     sc/source/ui/dialogs/searchresults \
     sc/source/ui/docshell/arealink \
     sc/source/ui/docshell/autostyl \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 75d6966..fa9d6ea 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -74,7 +74,6 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
     sc/source/ui/dbgui/textimportoptions \
     sc/source/ui/dbgui/tpsort \
     sc/source/ui/dbgui/tpsubt \
-    sc/source/ui/dbgui/validate \
     sc/source/ui/docshell/tpstat \
     sc/source/ui/miscdlgs/crdlg \
     sc/source/ui/miscdlgs/datafdlg \
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index d994763..52d8a62 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -485,13 +485,10 @@ public:
     virtual SfxAbstractTabDialog * CreateScParagraphDlg(vcl::Window* pParent,
         const SfxItemSet* pAttr) = 0;
 
-    virtual SfxAbstractTabDialog * CreateScValidationDlg(vcl::Window* pParent,
-        const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh) = 0;
     virtual SfxAbstractTabDialog * CreateScSortDlg(vcl::Window* pParent, const SfxItemSet* pArgSet) = 0;
 
     // for tabpage
     virtual CreateTabPage               GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
-    virtual GetTabPageRanges            GetTabPageRangesFunc() = 0;
 
 protected:
     ~ScAbstractDialogFactory() {}
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index a7a2540..5078aed 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -55,7 +55,6 @@
 #include "styledlg.hxx"
 #include "subtdlg.hxx"
 #include "textdlgs.hxx"
-#include "validate.hxx"
 #include "sortdlg.hxx"
 #include "textimportoptions.hxx"
 #include "opredlin.hxx"
@@ -998,13 +997,6 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScParagraphDlg(
     return new ScAbstractTabDialog_Impl(pDlg);
 }
 
-SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScValidationDlg(vcl::Window* pParent,
-    const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh)
-{
-    VclPtr<SfxTabDialog> pDlg = VclPtr<ScValidationDlg>::Create(pParent, pArgSet, pTabVwSh);
-    return new ScAbstractTabDialog_Impl(pDlg);
-}
-
 SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg(vcl::Window* pParent, const SfxItemSet* pArgSet)
 {
     VclPtr<SfxTabDialog> pDlg = VclPtr<ScSortDlg>::Create( pParent, pArgSet );
@@ -1043,9 +1035,4 @@ CreateTabPage ScAbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nI
     return nullptr;
 }
 
-GetTabPageRanges ScAbstractDialogFactory_Impl::GetTabPageRangesFunc()
-{
-    return ScTPValidationValue::GetRanges;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 014057e..356f519 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -549,16 +549,11 @@ public:
     virtual SfxAbstractTabDialog * CreateScParagraphDlg(vcl::Window* pParent,
         const SfxItemSet* pAttr) override;
 
-    virtual SfxAbstractTabDialog * CreateScValidationDlg(vcl::Window* pParent,
-        const SfxItemSet* pArgSet, ScTabViewShell *pTabVwSh) override;
-
     virtual SfxAbstractTabDialog * CreateScSortDlg(vcl::Window* pParent, const SfxItemSet* pArgSet) override;
 
     // For TabPage
     virtual CreateTabPage               GetTabPageCreatorFunc( sal_uInt16 nId ) override;
 
-    virtual GetTabPageRanges            GetTabPageRangesFunc() override;
-
 };
 
 #endif
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 354ae1f..240248f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -52,6 +52,7 @@
 #include "dbnamdlg.hxx"
 #include "reffact.hxx"
 #include "validat.hxx"
+#include "validate.hxx"
 #include "scresid.hxx"
 
 #include "scui_def.hxx"
@@ -201,15 +202,6 @@ static bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
     return bSort;
 }
 
-//after end execute from !IsModalInputMode, it is safer to delay deleting
-namespace
-{
-    void DelayDeleteAbstractDialog( void *pAbstractDialog, void * /*pArg*/ )
-    {
-        delete static_cast<SfxAbstractTabDialog*>( pAbstractDialog );
-    }
-}
-
 void ScCellShell::ExecuteDB( SfxRequest& rReq )
 {
     ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
@@ -798,11 +790,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                 }
                 else
                 {
-                    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-                    OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
-                    ::GetTabPageRanges ScTPValidationValueGetRanges = pFact->GetTabPageRangesFunc();
-                    OSL_ENSURE(ScTPValidationValueGetRanges, "TabPage create fail!");
-                    SfxItemSet aArgSet( GetPool(), (*ScTPValidationValueGetRanges)() );
+                    SfxItemSet aArgSet( GetPool(), ScTPValidationValue::GetRanges() );
                     ScValidationMode eMode = SC_VALID_ANY;
                     ScConditionMode eOper = SC_COND_EQUAL;
                     OUString aExpr1, aExpr2;
@@ -861,8 +849,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                     }
 
                     // cell range picker
-                    SfxAbstractTabDialog* pDlg = pFact->CreateScValidationDlg(nullptr, &aArgSet, pTabViewShell);
-                    assert(pDlg); //Dialog create fail!
+                    auto pDlg = VclPtr<ScValidationDlg>::Create(nullptr, &aArgSet, pTabViewShell);
 
                     short nResult = pDlg->Execute();
                     if ( nResult == RET_OK )
@@ -961,9 +948,6 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                         pTabViewShell->TestHintWindow();
                         rReq.Done( *pOutSet );
                     }
-                    //after end execute from !IsModalInputMode, it is safer to delay deleting
-                    //delete pDlg;
-                    Application::PostUserEvent( Link<void*,void>( pDlg, &DelayDeleteAbstractDialog ) );
                 }
             }
             break;


More information about the Libreoffice-commits mailing list