diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2023-04-07 00:40:43 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2023-04-07 09:34:01 +0200 |
commit | 3709d62860b07110a8420ff30c0150d81267b31d (patch) | |
tree | 95c7a8cb3b5e06ddf918983e3615a1ba9d95a8cb /sc | |
parent | 375f85f8518f49ce4381b6663f1e94fc02bacf93 (diff) |
crashtesting: crash on saving of fdo48916-1.ods
That document has <style:style ... style:family="graphic">
before <style:default-style style:family="graphic">. The
problem was that only the default style was creating the
draw layer (in ScDrawDefaultsObj::getModelPool), which
means that the SdrItemPool didn't exist at the time the
item set of the former style was created.
The easiest solution seems to ensure the draw layer
existence on each UNO style object creation, similar to
the other draw layer related objects in this method.
A similar fix was added recently for another scenario in
commit aec0830f31c2fd258de711baaa7da24bd01488c9 ("Ensure
valid SdrItemPool for drawing styles").
Change-Id: I50d89fea6d419119cd47ab163c82d1470b04b4a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150115
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/stlsheet.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/unoobj/servuno.cxx | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 665b806ba540..062be0a05280 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -227,6 +227,7 @@ SfxItemSet& ScStyleSheet::GetItemSet() SfxItemPool* pItemPool = &GetPool()->GetPool(); if (dynamic_cast<SdrItemPool*>(pItemPool) == nullptr) pItemPool = pItemPool->GetSecondaryPool(); + assert(pItemPool); pSet = new SfxItemSetFixed< XATTR_LINE_FIRST, XATTR_LINE_LAST, diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 855d0ae76b22..d135ad68abfa 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -425,7 +425,11 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( xRet.set(static_cast<style::XStyle*>(new ScStyleObj( nullptr, SfxStyleFamily::Page, OUString() ))); break; case Type::GRAPHICSTYLE: - xRet.set(static_cast<style::XStyle*>(new ScStyleObj( nullptr, SfxStyleFamily::Frame, OUString() ))); + if (pDocShell) + { + pDocShell->MakeDrawLayer(); + xRet.set(static_cast<style::XStyle*>(new ScStyleObj( nullptr, SfxStyleFamily::Frame, OUString() ))); + } break; case Type::AUTOFORMAT: xRet.set(static_cast<container::XIndexAccess*>(new ScAutoFormatObj( SC_AFMTOBJ_INVALID ))); |