summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-06-26 11:57:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-28 14:55:54 +0200
commitd900a952eb2267717797c7e91326a0ce3f222063 (patch)
tree7ab351a54a49d27d358612648f8c6a5f83108a5c /include/svx
parentc519de229627f3c6bb7736c810405b441c07f369 (diff)
reduce number of SvxUnoShape listeners on SdrModel
when we have a lot of shapes, the number of listeners attached to SdrModel becomes a serious bottleneck because of the number of broadcast/notify function calls. So (1) make SvxUnoShape listen to the SdrObject which achieves the same end, and reduces the bottleneck on the SdrModel. (2) repurpose the maAllIncarnatedObjects set, which tracks all objects linked to the SdrModel, so we can shut down the associated UNO shapes during ClearModel. There is no other good way of doing this, and if we don't do it, we get various use-after-free issues during shutdown. This takes the load time of a large DOCX with lots of shapes, from 35s to 17s on my machine. Change-Id: I34a6ac35c90de8b7103a7373aafe6e9607cc01c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169612 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/svdmodel.hxx10
-rw-r--r--include/svx/unoshape.hxx2
2 files changed, 4 insertions, 8 deletions
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 81ec0927db4c..f029d928aa8a 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -42,11 +42,7 @@
#include <rtl/ref.hxx>
#include <deque>
-
-#ifdef DBG_UTIL
-// SdrObjectLifetimeWatchDog
#include <unordered_set>
-#endif
class OutputDevice;
class SdrOutliner;
@@ -153,8 +149,9 @@ struct SdrModelImpl;
class SVXCORE_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase
{
-#ifdef DBG_UTIL
- // SdrObjectLifetimeWatchDog:
+ // We need to keep track of all the SdrObjects linked to this SdrModel so that we can
+ // shut them down cleanly, otherwise we end up with use-after-free issues.
+ //
// Use maAllIncarnatedObjects to keep track of all SdrObjects incarnated using this SdrModel
// (what is now possible after the paradigm change that a SdrObject stays at a single SdrModel
// for it's whole lifetime).
@@ -174,7 +171,6 @@ class SVXCORE_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase
friend void impAddIncarnatedSdrObjectToSdrModel(SdrObject& rSdrObject, SdrModel& rSdrModel);
friend void impRemoveIncarnatedSdrObjectToSdrModel(SdrObject& rSdrObject, SdrModel& rSdrModel);
std::unordered_set< SdrObject* > maAllIncarnatedObjects;
-#endif
protected:
std::vector<rtl::Reference<SdrPage>> maMasterPages;
std::vector<rtl::Reference<SdrPage>> maPages;
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index a72c3beae1b5..4ae84a2bc74e 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -226,7 +226,7 @@ public:
void setMaster( SvxShapeMaster* pMaster );
// SfxListener
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override;
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) noexcept override final;
// XAggregation
virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;