[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

Noel Grandin noel.grandin at collabora.co.uk
Sat Feb 4 16:53:42 UTC 2017


 sw/source/uibase/app/apphdl.cxx |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit aa09fd58bd499a2a2c3a32c5f613892bad54076c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 3 14:04:18 2017 +0200

    tdf#105684 crash in mail merge wizard
    
    commit eca5ea9f79181d45cd7fbabe2313617d3025818a
    "make the AbstractDialog stuff extend from VclReferenceBase"
    introduced this regression.
    
    Fix up the asynchronous delete to work again - necessary because
    the delete is triggered from deep inside the object it wants to
    delete.
    
    Change-Id: I18d5a899fbb2da772552ebba7fe6a8e810314010
    Reviewed-on: https://gerrit.libreoffice.org/33881
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 71863c6188a5a0bf9dd1c31c8ad9c7b8b9b9001b)
    Reviewed-on: https://gerrit.libreoffice.org/33889
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 00a9f81..5e2b809 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -383,11 +383,13 @@ class SwMailMergeWizardExecutor : public salhelper::SimpleReferenceObject
     SwView*                  m_pView;       // never owner
     SwView*                  m_pView2Close; // never owner
     VclPtr<AbstractMailMergeWizard> m_pWizard;     // always owner
+    VclPtr<AbstractMailMergeWizard> m_pWizardToDestroyInCallback;
+
     bool                     m_bDestroyMMToolbarOnCancel;
 
     DECL_LINK( EndDialogHdl, Dialog&, void );
     DECL_LINK( DestroyDialogHdl, void*, void );
-    DECL_STATIC_LINK( SwMailMergeWizardExecutor, DestroyWizardHdl, void*, void );
+    DECL_LINK( DestroyWizardHdl, void*, void );
     DECL_LINK( CancelHdl, void*, void );
     DECL_LINK( CloseFrameHdl, void*, void );
 
@@ -505,9 +507,11 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, Dialog&, void )
         {
             SwView* pNewView = lcl_LoadDoc(m_pView, m_pWizard->GetReloadDocument());
 
-            // destroy wizard asynchronously
+            // Destroy wizard asynchronously, since we are deep inside the wizard and dialog
+            // machinery code here
+            m_pWizardToDestroyInCallback = m_pWizard;
             Application::PostUserEvent(
-                LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+                LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), nullptr );
 
             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
             std::shared_ptr<SwMailMergeConfigItem> xMMConfig = m_pView->GetMailMergeConfigItem();
@@ -537,8 +541,9 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, Dialog&, void )
             if(pTargetView)
             {
                 // destroy wizard asynchronously
+                m_pWizardToDestroyInCallback = m_pWizard;
                 Application::PostUserEvent(
-                    LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+                    LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), nullptr );
 
                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
                 m_pWizard = pFact->CreateMailMergeWizard(*pTargetView, xMMConfig);
@@ -616,10 +621,9 @@ IMPL_LINK_NOARG(SwMailMergeWizardExecutor, DestroyDialogHdl, void*, void)
     release();
 }
 
-IMPL_STATIC_LINK(SwMailMergeWizardExecutor, DestroyWizardHdl, void*, pDialog, void )
+IMPL_LINK_NOARG(SwMailMergeWizardExecutor, DestroyWizardHdl, void*, void)
 {
-    VclPtr<AbstractMailMergeWizard> p = static_cast<AbstractMailMergeWizard*>(pDialog);
-    p.disposeAndClear();
+    m_pWizardToDestroyInCallback.disposeAndClear();
 }
 
 IMPL_LINK_NOARG(SwMailMergeWizardExecutor, CancelHdl, void*, void)


More information about the Libreoffice-commits mailing list