sc/inc/document.hxx | 4 ++-- sc/source/ui/view/viewfun3.cxx | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
New commits: commit a9d6b6ef049dd41c91a30c03df0ba38ba8dcada8 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu Oct 5 14:12:51 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Oct 9 11:00:21 2023 +0200 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 #3 0x00007f6d5e81ee6e in ScDocShell::GetRefDevice (this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh3.cxx:471 #4 0x00007f6d5e823439 in ScDocShell::UpdateFontList (this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh3.cxx:462 #5 0x00007f6d5e81dd6c in ScDocShell::InitItems (this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh2.cxx:98 #6 0x00007f6d5e81e80b in ScDocShell::InitNew (this=0x4697e6e0, xStor=...) at libreoffice/sc/source/ui/docshell/docsh2.cxx:83 #7 0x00007f6d6e2ce99d in SfxObjectShell::DoInitNew (this=this@entry=0x4697e6e0) at libreoffice/sfx2/source/doc/objstor.cxx:470 #8 0x00007f6d5e768daf in ScTransferObj::SetDrawClipDoc (bAnyOle=<optimized out>, pDoc=std::shared_ptr<ScDocument> (use count 2, weak count 0) = {...}) at libreoffice/sc/source/ui/app/transobj.cxx:821 #9 0x00007f6d5ec4735a in ScViewFunc::CopyToClipSingleRange (this=0x37a257a0, pClipDoc=<optimized out>, rRanges=..., bCut=<optimized out>, bIncludeObjects=<optimized out>) at libreoffice/sc/source/ui/view/viewfun3.cxx:248 #10 0x00007f6d5ec48ab0 in ScViewFunc::CopyToClip (this=this@entry=0x37a257a0, pClipDoc=pClipDoc@entry=0x0, rRanges=..., bCut=bCut@entry=false, bApi=bApi@entry=false, bIncludeObjects=bIncludeObjects@entry=true, bStopEdit=true) at libreoffice/sc/source/ui/view/viewfun3.cxx:212 #11 0x00007f6d5ec48dc3 in ScViewFunc::CopyToClip (this=this@entry=0x37a257a0, pClipDoc=pClipDoc@entry=0x0, bCut=bCut@entry=false, bApi=bApi@entry=false, bIncludeObjects=bIncludeObjects@entry=true, bStopEdit=bStopEdit@entry=true) at libreoffice/sc/source/ui/view/viewfun3.cxx:178 #12 0x00007f6d5eb0eada in ScCellShell::ExecuteEdit (this=0x35c3d240, rReq=...) at libreoffice/sc/source/ui/view/cellsh1.cxx:1369 Change-Id: I1eb90a0190719a0ffe52dcdc5b0d87f5198cd5a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157594 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 48c0ada1745be2cd817d5bd8a912530028fa8419) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157619 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 300d6f7817e0..875c2489a14e 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2694,6 +2694,8 @@ 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 ); @@ -2703,8 +2705,6 @@ 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/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 8a9b489833fc..9c32230275f4 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -242,6 +242,9 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList& if ( pSysClipDoc && 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 ) ); }