diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-26 21:42:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-27 10:02:15 +0100 |
commit | 8872f7121b4ae4dd0b51820366d3510a88f7aac2 (patch) | |
tree | 447a6988c6099ed6a04f892c0d2032b6148f5057 | |
parent | dd889b290304b73f96a9a8e6e0f144d3aa2ba7e1 (diff) |
crashtesting: crash on exporting kde274105-6.docx to .rtf
since:
commit 9ae8e74fb32254c81d36b1c95411605459e06372
Date: Tue Mar 5 11:01:42 2024 -0700
tdf#50934: Add a pie-with-remainder-as-another-pie chart type
but this sort of problem has arisen before at:
commit 3a2c2ad839860dcb36e30ae1a2867e4d5e1036fc
Date: Wed Jan 30 10:12:44 2019 +0000
crashtesting: crash exporting ooo58458-1.odt to doc
since...
commit 8780fa41dcd164af244742461f4e57a4bcf4c7a4
Date: Tue Oct 30 12:23:36 2018 +0100
svtools: fix lost replacement grpahic when updating it via OLE fails
and back in:
commit ca9dd36bb0f2f8a5bcb0e5621ec181cc6f29ad73
Date: Tue May 22 18:34:28 2007 +0000
INTEGRATION: CWS chart2mst3 (1.16.4); FILE MERGED
2006/08/04 09:32:02 iha 1.16.4.1: don't crash while resizing some charts when replacement graphic happens to be empty
the same issue of charts triggering UpdateReplacementOnDemand on
modifications which happen during generating the Replacement Graphic.
Presumably no modifications should happen during this process and those
are the underlying bugs.
Change-Id: I27172a7bd62d836f8e47f826de3ea941881459bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165358
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | svtools/source/misc/embedhlp.cxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index d784b20a4a39..370d0f6b10ca 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -461,12 +461,10 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate ) mpImpl->oGraphic.reset(); mpImpl->aMediaType.clear(); - mpImpl->oGraphic.emplace(); mpImpl->mnGraphicVersion++; } else if ( !mpImpl->oGraphic ) { - mpImpl->oGraphic.emplace(); mpImpl->mnGraphicVersion++; } else @@ -475,6 +473,8 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate ) return; } + mpImpl->oGraphic.emplace(); + std::unique_ptr<SvStream> pGraphicStream(GetGraphicStream( bUpdate )); if (!pGraphicStream && aOldGraphic.IsNone()) { @@ -485,17 +485,24 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate ) "EmbeddedObjectRef::GetReplacement: failed to get updated graphic stream"); } + if (!mpImpl->oGraphic) + { + // note that UpdateReplacementOnDemand which resets mpImpl->oGraphic to null may have been called + // e.g. when exporting ooo58458-1.odt to doc or kde274105-6.docx to rtf. Those looks like bugs as + // presumably generating the replacement graphic shouldn't re-trigger that the graphic needs + // to be updated, bodge this to work as callers naturally expect + SAL_WARN("svtools.misc", "EmbeddedObjectRef::GetReplacement generating replacement image modified object to claim it needs to update replacement"); + mpImpl->oGraphic.emplace(); + } + if ( pGraphicStream ) { GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); - if( mpImpl->oGraphic ) - rGF.ImportGraphic( *mpImpl->oGraphic, u"", *pGraphicStream ); + rGF.ImportGraphic( *mpImpl->oGraphic, u"", *pGraphicStream ); mpImpl->mnGraphicVersion++; } - // note that UpdateReplacementOnDemand which resets mpImpl->oGraphic to null may have been called - // e.g. when exporting ooo58458-1.odt to doc - if (bUpdate && (!mpImpl->oGraphic || mpImpl->oGraphic->IsNone()) && !aOldGraphic.IsNone()) + if (bUpdate && mpImpl->oGraphic->IsNone() && !aOldGraphic.IsNone()) { // We used to have an old graphic, tried to update and the update // failed. Go back to the old graphic instead of having no graphic at |