diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-06-23 11:47:03 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-07-06 16:50:06 +0200 |
commit | b7ce02818efbf23848e1f0176370a24c9cc3f29d (patch) | |
tree | 9f750b238fe30bb0a7ec9178d6580e7263fb83ff | |
parent | tdf#128150 Disable UseSlideBackground item when setting style back to None (diff) | |
download | core-b7ce02818efbf23848e1f0176370a24c9cc3f29d.tar.gz core-b7ce02818efbf23848e1f0176370a24c9cc3f29d.zip |
tdf#149650 avoid potential recursion with SdrPage content hierarchy
Change-Id: I27e064eeedfb45a2fe96892f1d31da94b9976c50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136303
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
-rw-r--r-- | svx/source/sdr/primitive2d/sdrdecompositiontools.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 6026a655cfa0..aa1723e49e1d 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -60,6 +60,7 @@ #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/displayinfo.hxx> #include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <set> using namespace com::sun::star; @@ -330,8 +331,35 @@ void SlideBackgroundFillPrimitive2D::get2DDecomposition( const_cast< SlideBackgroundFillPrimitive2D* >(this)->mpLastVC = pViewContact; } + // tdf#149650 allow remember/detect of potential recursion for content creation. + // use a std::set association - instead of a single bool or adress - due to the + // possibility of multiple SlideBackgroundFillPrimitive2D's being used at the same + // refresh. Also possible would be a local member (bool), but that just makes the + // class more complicated. Working wth the adress is not a problem here since below + // it reliably gets added/removed while being incarnated only. + static std::set<const SlideBackgroundFillPrimitive2D*> potentiallyActiveRecursion; + + if(potentiallyActiveRecursion.end() != potentiallyActiveRecursion.find(this)) + { + // The method getPrimitive2DSequenceSubHierarchy used in create2DDecomposition + // above has the potential to create a recursion, e.g. when the content of a page + // contains a SdrPageObj that again displays the page content (and potentially so + // on). + // This is valid, but works like a fractal, showing page content + // smaller and smaller inside a page. This needs to be controlled here to avoid + // the recursion. In this case just allow one single step since + // we are mainly interested in the page's BG fill anyways + return; + } + + // remember that we enter a potential recursion + potentiallyActiveRecursion.insert(this); + // use parent implementation BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation); + + // forget about potential recursion + potentiallyActiveRecursion.extract(this); } bool SlideBackgroundFillPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |