sw/source/ui/dbui/mmoutputpage.cxx | 25 +++++++++++++++---------- sw/source/ui/dbui/mmoutputpage.hxx | 1 - 2 files changed, 15 insertions(+), 11 deletions(-)
New commits: commit f3020438938d019784d32fffeaf5f18dc6175ed8 Author: Michael Stahl <mst...@redhat.com> Date: Mon Oct 1 23:02:57 2012 +0200 fdo#55496: fix lifecycle of SwMailMergeOutputPage: Its member m_pDocumentPrinterCopy contains a SfxItemSet that points at the SwDoc's item pool; the SwDoc is freed in SwMailMergeWizardExecutor::LinkStubCancelHdl. But the SwDoc::setPrinter method does seem to work fine if the printer that is set is the same as the one it already has, so it does not seem to be necessary to clone the printer; just get it and set it again. Change-Id: Ic591f68f6e0bab4e42cb22a9cb0a47e97f5e938f diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index b8e5cef..73b39c9 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -330,8 +330,7 @@ SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) : #endif m_bCancelSaving( false ), m_pWizard(_pParent), - m_pTempPrinter( 0 ), - m_pDocumentPrinterCopy(0) + m_pTempPrinter( 0 ) { FreeResource(); @@ -383,7 +382,6 @@ SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) : SwMailMergeOutputPage::~SwMailMergeOutputPage() { delete m_pTempPrinter; - delete m_pDocumentPrinterCopy; } void SwMailMergeOutputPage::ActivatePage() @@ -409,7 +407,6 @@ void SwMailMergeOutputPage::ActivatePage() m_aPrinterLB.SelectEntry( pPrinter->GetName() ); m_aToNF.SetValue( rConfigItem.GetMergedDocumentCount() ); m_aToNF.SetMax( rConfigItem.GetMergedDocumentCount() ); - m_pDocumentPrinterCopy = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true )->Clone(); } m_aPrinterLB.SelectEntry( rConfigItem.GetSelectedPrinter() ); @@ -852,7 +849,10 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { - if( m_pDocumentPrinterCopy && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + SwView *const pTargetView = m_pWizard->GetConfigItem().GetTargetView(); + SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() + .getIDocumentDeviceAccess()->getPrinter(true); + if (pDocumentPrinter && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) { const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), false ); @@ -860,9 +860,11 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) { if ( !m_pTempPrinter ) { - if( (m_pDocumentPrinterCopy->GetName() == pInfo->GetPrinterName()) && - (m_pDocumentPrinterCopy->GetDriverName() == pInfo->GetDriver()) ) - m_pTempPrinter = new Printer( m_pDocumentPrinterCopy->GetJobSetup() ); + if ((pDocumentPrinter->GetName() == pInfo->GetPrinterName()) && + (pDocumentPrinter->GetDriverName() == pInfo->GetDriver())) + { + m_pTempPrinter = new Printer(pDocumentPrinter->GetJobSetup()); + } else m_pTempPrinter = new Printer( *pInfo ); } @@ -922,8 +924,11 @@ IMPL_LINK_NOARG(SwMailMergeOutputPage, PrintHdl_Impl) pTargetView->SetMailMergeConfigItem(&rConfigItem, 0, sal_False); if(m_pTempPrinter) { - m_pDocumentPrinterCopy->SetPrinterProps(m_pTempPrinter); - pTargetView->SetPrinter(m_pDocumentPrinterCopy->Clone()); + SfxPrinter *const pDocumentPrinter = pTargetView->GetWrtShell() + .getIDocumentDeviceAccess()->getPrinter(true); + pDocumentPrinter->SetPrinterProps(m_pTempPrinter); + // this should be able to handle setting its own printer + pTargetView->SetPrinter(pDocumentPrinter); } SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell(); diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx index 0aace25..0babb24 100644 --- a/sw/source/ui/dbui/mmoutputpage.hxx +++ b/sw/source/ui/dbui/mmoutputpage.hxx @@ -118,7 +118,6 @@ class SwMailMergeOutputPage : public svt::OWizardPage //some dialog data Printer* m_pTempPrinter; - SfxPrinter* m_pDocumentPrinterCopy; String m_sCC; String m_sBCC; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits