From cc5899ff62dd4e9c76aa456fe845c5812bb8d93a Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Wed, 9 Dec 2015 07:48:01 +0100 Subject: tdf#94816: fixed some problems in the mail merge wizard Some disposeAndClear have been added as calling dialogs in the wizard like select address list, new address list, match fields crashed in dbg build in shutdown because the dialogs were still alive. The wizard is now deleted on Cancel which didn't work anymore. The timeout of the preview control of page 5 has been changed as the preview didn't even appear on Windows in a debug build The timeout handler was called after the wizard has been closed and lead to a crash. Change-Id: I9cd01f39347744bda31a312f695d27eefa077721 Reviewed-on: https://gerrit.libreoffice.org/20489 Tested-by: Jenkins Reviewed-by: Oliver Specht Tested-by: Oliver Specht --- sw/source/ui/dbui/createaddresslistdialog.cxx | 4 ++-- sw/source/ui/dbui/mmaddressblockpage.cxx | 6 +++--- sw/source/ui/dbui/mmgreetingspage.cxx | 4 ++-- sw/source/uibase/app/apphdl.cxx | 2 +- sw/source/uibase/dbui/mmconfigitem.cxx | 3 ++- sw/source/uibase/utlui/unotools.cxx | 4 +++- 6 files changed, 13 insertions(+), 10 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index d85bac57b4fe..d1ef267898a2 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -126,8 +126,8 @@ void SwAddressControl_Impl::dispose() for(auto aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter) aEditIter->disposeAndClear(); m_aEdits.clear(); - m_pScrollBar.clear(); - m_pWindow.clear(); + m_pScrollBar.disposeAndClear(); + m_pWindow.disposeAndClear(); Control::dispose(); } diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 84a7564ade1f..02014b3e25b9 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -163,7 +163,7 @@ IMPL_LINK_NOARG_TYPED(SwMailMergeAddressBlockPage, AddressListHdl_Impl, Button*, { try { - VclPtrInstance< SwAddressListDialog > xAddrDialog(this); + ScopedVclPtrInstance< SwAddressListDialog > xAddrDialog(this); if(RET_OK == xAddrDialog->Execute()) { SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem(); @@ -188,7 +188,7 @@ IMPL_LINK_NOARG_TYPED(SwMailMergeAddressBlockPage, AddressListHdl_Impl, Button*, IMPL_LINK_TYPED(SwMailMergeAddressBlockPage, SettingsHdl_Impl, Button*, pButton, void) { - VclPtr pDlg( + ScopedVclPtr pDlg( VclPtr::Create(pButton, m_pWizard->GetConfigItem())); SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem(); pDlg->SetAddressBlocks(rConfig.GetAddressBlocks(), m_pSettingsWIN->GetSelectedAddress()); @@ -207,7 +207,7 @@ IMPL_LINK_TYPED(SwMailMergeAddressBlockPage, SettingsHdl_Impl, Button*, pButton, rConfig.SetCountrySettings(pDlg->IsIncludeCountry(), pDlg->GetCountry()); InsertDataHdl_Impl(nullptr); } - pDlg.reset(); + pDlg.disposeAndClear(); GetWizard()->UpdateRoadmap(); GetWizard()->enableButtons(WizardButtonFlags::NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE)); } diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx index 40c4307adbc6..105bb6e8e925 100644 --- a/sw/source/ui/dbui/mmgreetingspage.cxx +++ b/sw/source/ui/dbui/mmgreetingspage.cxx @@ -103,7 +103,7 @@ IMPL_LINK_NOARG_TYPED(SwGreetingsHandler, IndividualHdl_Impl, Button*, void) IMPL_LINK_TYPED(SwGreetingsHandler, GreetingHdl_Impl, Button*, pButton, void) { - VclPtr pDlg( + ScopedVclPtr pDlg( VclPtr::Create(pButton, m_pWizard->GetConfigItem(), pButton == m_pMalePB ? SwCustomizeAddressBlockDialog::GREETING_MALE : @@ -129,7 +129,7 @@ void SwGreetingsHandler::UpdatePreview() IMPL_LINK_TYPED(SwMailMergeGreetingsPage, AssignHdl_Impl, Button*, pButton, void) { const OUString sPreview(m_pFemaleLB->GetSelectEntry() + "\n" + m_pMaleLB->GetSelectEntry()); - VclPtr pDlg( + ScopedVclPtr pDlg( VclPtr::Create(pButton, m_pWizard->GetConfigItem(), sPreview, false)); if(RET_OK == pDlg->Execute()) { diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 39ed27367a19..bd18537a5e39 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -594,7 +594,7 @@ IMPL_LINK_NOARG_TYPED(SwMailMergeWizardExecutor, CancelHdl, void*, void) m_pMMConfig->Commit(); delete m_pMMConfig; m_pMMConfig = nullptr; - // m_pWizard already deleted by closing the target view + delete m_pWizard; m_pWizard = nullptr; release(); } diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index f78a85bc67e3..b576da35dde1 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -734,7 +734,8 @@ SwMailMergeConfigItem::SwMailMergeConfigItem() : {} SwMailMergeConfigItem::~SwMailMergeConfigItem() -{} +{ +} void SwMailMergeConfigItem::Commit() { diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 1a2c22e66ca2..5ed25c464adf 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -83,7 +83,7 @@ SwOneExampleFrame::SwOneExampleFrame( vcl::Window& rWin, // the controller is asynchronously set aLoadedIdle.SetIdleHdl(LINK(this, SwOneExampleFrame, TimeoutHdl)); - aLoadedIdle.SetPriority(SchedulerPriority::LOWER); + aLoadedIdle.SetPriority(SchedulerPriority::HIGH); CreateControl(); @@ -159,6 +159,8 @@ void SwOneExampleFrame::CreateControl() void SwOneExampleFrame::DisposeControl() { + aLoadedIdle.Stop(); + aTopWindow.clear(); _xCursor = nullptr; if(_xControl.is()) _xControl->dispose(); -- cgit v1.2.1