sc/inc/document.hxx | 4 ++-- sc/source/core/data/documen8.cxx | 7 +++++-- sc/source/ui/view/viewfun3.cxx | 3 --- 3 files changed, 7 insertions(+), 7 deletions(-)
New commits: commit f259c295f13f3b93aa585625174a14d3aa2999fc Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Jan 7 13:37:57 2024 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jan 8 11:03:42 2024 +0100 Resolves: tdf#159046 hang on export of math objects in cells regression from: commit a9d6b6ef049dd41c91a30c03df0ba38ba8dcada8 Date: Thu Oct 5 14:12:51 2023 +0100 crash copying text + chart to clipboard with InputOptions::TextWysiwyg of true, the mxPoolHelper is still null when trying to create a Printer to use as a reference device revert that, and use a different simpler workaround for the original crash case. Change-Id: I74cec710aec033e1652e637ed056dae1c261aa98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161742 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 8b91cbf49b0e..eb69570de6f8 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2709,8 +2709,6 @@ public: const ScTable* FetchTable( SCTAB nTab ) const; ScRefCellValue GetRefCellValue( const ScAddress& rPos ); - - void SharePooledResources( const ScDocument* pSrcDoc ); private: ScRefCellValue GetRefCellValue( const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos ); @@ -2720,6 +2718,8 @@ private: SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; void ReservePatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserve ); + void SharePooledResources( const ScDocument* pSrcDoc ); + void EndListeningIntersectedGroup( sc::EndListeningContext& rCxt, const ScAddress& rPos, std::vector<ScAddress>* pGroupPos ); diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 04696b7696e9..c3d660577ea1 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -113,7 +113,7 @@ void ScDocument::ImplDeleteOptions() SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist) { - if ( !mpPrinter && bCreateIfNotExist ) + if (!mpPrinter && bCreateIfNotExist && mxPoolHelper) { auto pSet = std::make_unique<SfxItemSetFixed @@ -201,8 +201,11 @@ OutputDevice* ScDocument::GetRefDevice(bool bForceVirtDev) // Create printer like ref device, see Writer... OutputDevice* pRefDevice = nullptr; if ( !bForceVirtDev && SC_MOD()->GetInputOptions().GetTextWysiwyg() ) + { pRefDevice = GetPrinter(); - else + SAL_WARN_IF(!pRefDevice, "sc", "unable to get a printer, fallback to virdev"); + } + if (!pRefDevice) pRefDevice = GetVirtualDevice_100th_mm(); return pRefDevice; } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 4f5dea599230..567447149937 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -244,9 +244,6 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList& if ( bSysClip && bIncludeObjects ) { bool bAnyOle = rDoc.HasOLEObjectsInArea( aRange ); - // There are optional paths (e.g. bAnyOle and InputOptions().GetTextWysiwyg true) - // which dereference pSysClipDoc->mxPoolHelper so ensure that is set here. - pSysClipDoc->SharePooledResources(&rDoc); // Update ScGlobal::xDrawClipDocShellRef. ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle, pSysClipDoc ) ); }