[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Feb 11 06:02:43 UTC 2019


 sw/source/uibase/app/docst.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 6e8c9bdf0a55141d3cbd181862aec89b788bb060
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jan 9 11:54:06 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 11 07:02:21 2019 +0100

    using ScopedVclPtr with StartExecuteAsync not good
    
    Which doesn't actually make much of a difference in this case because
    this is a welded dialog, which currently does not preserve a VclPtr
    owner of such dialogs.
    
    Perhaps we should rather fix the
       SfxTabDialogController::runAsync
    infrastructure to temporarily
    (a) preserve an owner for such dialogs
    (b) disposeAndClear such dialogs
    at least until we are done with welding?
    
    Otherwise this is very confusing.
    
    Change-Id: I568eb6813925299663ac3f90749b64076d404d19
    Reviewed-on: https://gerrit.libreoffice.org/65708
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index e57b4e50e0d7..3e738a838911 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -548,11 +548,11 @@ public:
         SfxStyleFamily nFamily, SfxAbstractApplyTabDialog *pDlg,
         rtl::Reference< SfxStyleSheetBasePool > const & xBasePool,
         bool bModified)
-        : m_rDocSh(rDocSh)
+        : m_pDlg(pDlg)
+        , m_rDocSh(rDocSh)
         , m_bNew(bNew)
         , m_xTmp(xTmp)
         , m_nFamily(nFamily)
-        , m_pDlg(pDlg)
         , m_xBasePool(xBasePool)
         , m_bModified(bModified)
     {
@@ -562,12 +562,12 @@ public:
     {
         ApplyHdl(nullptr);
     }
+    VclPtr<SfxAbstractApplyTabDialog> m_pDlg;
 private:
     SwDocShell &m_rDocSh;
     bool const m_bNew;
     rtl::Reference< SwDocStyleSheet > m_xTmp;
     SfxStyleFamily const m_nFamily;
-    VclPtr<SfxAbstractApplyTabDialog> m_pDlg;
     rtl::Reference< SfxStyleSheetBasePool > m_xBasePool;
     bool const m_bModified;
 };
@@ -818,7 +818,7 @@ void SwDocShell::Edit(
         FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
         SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-        ScopedVclPtr<SfxAbstractApplyTabDialog> pDlg(pFact->CreateTemplateDialog(GetView()->GetViewFrame()->GetWindow().GetFrameWeld(),
+        VclPtr<SfxAbstractApplyTabDialog> pDlg(pFact->CreateTemplateDialog(GetView()->GetViewFrame()->GetWindow().GetFrameWeld(),
                                                     *xTmp, nFamily, sPage, pCurrShell, bNew));
         std::shared_ptr<ApplyStyle> pApplyStyleHelper(new ApplyStyle(*this, bNew, xTmp, nFamily, pDlg.get(), m_xBasePool, bModified));
         pDlg->SetApplyHdl(LINK(pApplyStyleHelper.get(), ApplyStyle, ApplyHdl));
@@ -863,6 +863,7 @@ void SwDocShell::Edit(
                 pShell->SetWatermark(aWatermark);
             }
 
+            pApplyStyleHelper->m_pDlg.disposeAndClear();
             if (pRequest)
                 pRequest->Done();
         });


More information about the Libreoffice-commits mailing list