summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorPatrick Luby <plubius@libreoffice.org>2023-12-23 09:35:06 -0500
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-29 12:43:15 +0100
commit744aaf0d068505fdbf4dcc66eabaf495cdd4fcb3 (patch)
treed8b4b42759455fd54192b794e905af1dcd85c24c /drawinglayer
parent226e23d6a26bb3710712e9a865c6b222cd3db76f (diff)
Related: tdf#158807 mutex must be locked when disposing a VirtualDevice
If the following .ppt document is opened in a debug build and the document is left open for a minute or two without changing any content, this destructor will be called on a non-main thread with the mutex unlocked: https://bugs.documentfoundation.org/attachment.cgi?id=46801 This hits an assert in VirtualDevice::ReleaseGraphics() so explicitly lock the mutex and explicitly dispose and clear the VirtualDevice instances variables. Change-Id: I5d371a4e99fca4aae2b6edc8b53eca10cb143aef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161243 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@libreoffice.org> (cherry picked from commit 0f8ad0f55e118f1f016b250de0c7940c7e21062a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161219 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 8e0c8a980f33..ad4c8a28c915 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -344,6 +344,7 @@ namespace drawinglayer::primitive2d
AnimatedGraphicPrimitive2D(
const Graphic& rGraphic,
basegfx::B2DHomMatrix aTransform);
+ virtual ~AnimatedGraphicPrimitive2D();
/// data read access
const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
@@ -407,6 +408,23 @@ namespace drawinglayer::primitive2d
}
}
+ AnimatedGraphicPrimitive2D::~AnimatedGraphicPrimitive2D()
+ {
+ // Related: tdf#158807 mutex must be locked when disposing a VirtualDevice
+ // If the following .ppt document is opened in a debug build
+ // and the document is left open for a minute or two without
+ // changing any content, this destructor will be called on a
+ // non-main thread with the mutex unlocked:
+ // https://bugs.documentfoundation.org/attachment.cgi?id=46801
+ // This hits an assert in VirtualDevice::ReleaseGraphics() so
+ // explicitly lock the mutex and explicitly dispose and clear
+ // the VirtualDevice instances variables.
+ const SolarMutexGuard aSolarGuard;
+
+ maVirtualDevice.disposeAndClear();
+ maVirtualDeviceMask.disposeAndClear();
+ }
+
bool AnimatedGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
// do not use 'GroupPrimitive2D::operator==' here, that would compare