crashtesting: crash on reexport of tdf118346-1.odg to odg
#10 0x00007fffef6f9e1c in vcl::graphic::Manager::reduceGraphicMemory() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:120
#11 0x00007fffef6fa0c4 in vcl::graphic::Manager::registerGraphic(std::shared_ptr<ImpGraphic> const&) (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager> std::shared_ptr<ImpGraphic> (use count 1, weak count 0) = {...}) at vcl/source/graphic/Manager.cxx:159
#12 0x00007fffef6fa749 in vcl::graphic::Manager::newInstance() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:202
#13 0x00007fffef4aba15 in Graphic::Graphic() (this=0x7ffffff32f18) at vcl/source/gdi/graph.cxx:163
#14 0x00007fff9409761c in svgio::svgreader::SvgImageNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2b4e46b0, rTarget=...)
at svgio/source/svgreader/svgimagenode.cxx:220
#15 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f6d0, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svgnode.cxx:529
#16 0x00007fff94092a0b in svgio::svgreader::SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f6d0, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svggnode.cxx:107
#17 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f370, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svgnode.cxx:529
#18 0x00007fff94092a0b in svgio::svgreader::SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f370, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svggnode.cxx:107
#19 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2704ee70, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svgnode.cxx:529
#20 0x00007fff940cc179 in svgio::svgreader::SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2704ee70, rTarget=..., bReferenced=false)
at svgio/source/svgreader/svgsvgnode.cxx:304
#21 0x00007fff940fa8cf in svgio::svgreader::(anonymous namespace)::XSvgParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) (this=0x26ee6560, xSVGStream=uno::Reference to (comphelper::SequenceInputStream *) 0x2b4190e8, aAbsolutePath="") at svgio/source/svguno/xsvgparser.cxx:136
#22 0x00007fff940fb0a5 in non-virtual thunk to svgio::svgreader::(anonymous namespace)::XSvgParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) () at svgio/source/svguno/xsvgparser.cxx:188
#23 0x00007fffef6af2f3 in VectorGraphicData::ensureSequenceAndRange() (this=0x70f6a70) at vcl/source/gdi/vectorgraphicdata.cxx:209
#24 0x00007fffef6b01bc in VectorGraphicData::getRange() const (this=0x70f6a70) at vcl/source/gdi/vectorgraphicdata.cxx:355
#25 0x00007fffef4bd4f0 in ImpGraphic::getPrefSize() const (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:793
#26 0x00007fffef4bd049 in ImpGraphic::createSwapInfo() (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:360
#27 0x00007fffef4c1960 in ImpGraphic::swapOut() (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:1304
#28 0x00007fffef6f9ca8 in vcl::graphic::Manager::loopGraphicsAndSwapOut() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:104
#29 0x00007fffef6f9e1c in vcl::graphic::Manager::reduceGraphicMemory() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:120
Change-Id: If76281620dd7026196543ff3f62f29105b1e2f38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112772
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index 4319620..bfd9ef3 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -35,6 +35,7 @@
o3tl::sorted_vector<ImpGraphic*> m_pImpGraphicList;
std::chrono::seconds mnAllowedIdleTime;
bool mbSwapEnabled;
bool mbReducingGraphicMemory;
sal_Int64 mnMemoryLimit;
sal_Int64 mnUsedSize;
Timer maSwapOutTimer;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index 054a615..b6cb1c0 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -60,6 +60,7 @@
Manager::Manager()
: mnAllowedIdleTime(10)
, mbSwapEnabled(true)
, mbReducingGraphicMemory(false)
, mnMemoryLimit(300000000)
, mnUsedSize(0)
, maSwapOutTimer("graphic::Manager maSwapOutTimer")
@@ -117,6 +118,11 @@
std::scoped_lock<std::recursive_mutex> aGuard(maMutex);
// avoid recursive reduceGraphicMemory on reexport of tdf118346-1.odg to odg
if (mbReducingGraphicMemory)
return;
mbReducingGraphicMemory = true;
loopGraphicsAndSwapOut();
sal_Int64 calculatedSize = 0;
@@ -132,6 +138,8 @@
{
mnUsedSize = calculatedSize;
}
mbReducingGraphicMemory = false;
}
sal_Int64 Manager::getGraphicSizeBytes(const ImpGraphic* pImpGraphic)