[Libreoffice-commits] core.git: sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Feb 3 14:42:41 UTC 2017
sw/source/uibase/app/apphdl.cxx | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
New commits:
commit 71863c6188a5a0bf9dd1c31c8ad9c7b8b9b9001b
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>
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index eaaabf9..4c791be 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -359,11 +359,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 );
@@ -496,9 +498,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();
@@ -528,8 +532,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);
@@ -607,10 +612,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