sc/source/ui/app/transobj.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
New commits: commit aec0830f31c2fd258de711baaa7da24bd01488c9 Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Mon Apr 3 16:01:44 2023 +0300 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Mon Apr 3 17:04:40 2023 +0200 Ensure valid SdrItemPool for drawing styles ... when pasting cells as OLE object. Problem caught by UBSAN build with UITest_conditional_format UITEST_TEST_NAME=tdf117899.Tdf117899.test_tdf117899: /sc/source/core/data/stlsheet.cxx:238:53: runtime error: reference binding to null pointer of type 'SfxItemPool' #0 0x7f9cb1ef60ce in ScStyleSheet::GetItemSet() /sc/source/core/data/stlsheet.cxx:231:28 #1 0x7f9cb1ed52e3 in ScStyleSheetPool::CopyStyleFrom(SfxStyleSheetBasePool*, rtl::OUString const&, SfxStyleFamily, bool) /sc/source/core/data/stlpool.cxx:144:40 #2 0x7f9cb1ed9285 in ScStyleSheetPool::CopyStdStylesFrom(ScStyleSheetPool*) /sc/source/core/data/stlpool.cxx:223:5 #3 0x7f9cb0e25d51 in ScDocument::CopyStdStylesFrom(ScDocument const&) /sc/source/core/data/documen8.cxx:292:35 #4 0x7f9cb4602d7c in ScTransferObj::InitDocShell(bool) /sc/source/ui/app/transobj.cxx:683:14 ScStyleSheetPool::CopyStdStylesFrom wants to create/update the default drawing style, but in case the source clipdoc didn't have shapes - without creating ScDrawLayer first, which means no SdrItemPool exists. Fix that by creating ScDrawLayer unconditionally, as we attempt to do this later on anyway. Regression of commit 685a864cfc40227559ed55f6273fd118174e8e6e ("sc drawstyles: Clipboard support"). Change-Id: I3def9860ab4f11c70c120f5324a60adf63056a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149966 Tested-by: Maxim Monastirsky <momonas...@gmail.com> Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 138b0789370b..f19bf94a4ff1 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -677,8 +677,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName ); rDestDoc.RenameTab( 0, aTabName ); - if (m_pDoc->GetDrawLayer() || m_pDoc->HasNotes()) - pDocSh->MakeDrawLayer(); + pDocSh->MakeDrawLayer(); rDestDoc.CopyStdStylesFrom(*m_pDoc);