summaryrefslogtreecommitdiff
path: root/include/svl/itemset.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-02-18 10:56:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-18 11:53:27 +0100
commitfe2ec505786bacc6f3baca3292367903644ac99b (patch)
tree34c79dbc66f0fef4142d6675891ea1b15a54ec3a /include/svl/itemset.hxx
parent657095c9d26147e290e7944db875b9555b33dd1a (diff)
improve the SfxItemSet::CloneAsValue check
to prevent object slicing. Which reveals a problems with commit 044fa30a4c77013c87a7e2a6dd9022a2f6599778 Author: Noel Grandin <noelgrandin@gmail.com> Date: Thu Sep 23 18:44:42 2021 +0200 no need to allocate this SfxItemSet on the heap and commit 044fa30a4c77013c87a7e2a6dd9022a2f6599778 Author: Noel Grandin <noelgrandin@gmail.com> Date: Thu Sep 23 18:44:42 2021 +0200 no need to allocate this SfxItemSet on the heap so revert the problematic bits of those commits Change-Id: I5eeba1d5bdb91f4e539850516f2b1c11e69ff2c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130127 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svl/itemset.hxx')
-rw-r--r--include/svl/itemset.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 5ce13bb1f4c8..8d5b9c3bb601 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -88,7 +88,9 @@ public:
virtual ~SfxItemSet();
virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
- virtual SfxItemSet CloneAsValue(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
+ /** note that this only works if you know for sure that you are dealing with an SfxItemSet
+ and not one of it's subclasses. */
+ SfxItemSet CloneAsValue(bool bItems = true, SfxItemPool *pToPool = nullptr) const;
// Get number of items
sal_uInt16 Count() const { return m_nCount; }
@@ -219,7 +221,6 @@ public:
SfxAllItemSet( const SfxAllItemSet & );
virtual std::unique_ptr<SfxItemSet> Clone( bool bItems = true, SfxItemPool *pToPool = nullptr ) const override;
- virtual SfxItemSet CloneAsValue( bool bItems = true, SfxItemPool *pToPool = nullptr ) const override;
private:
virtual const SfxPoolItem* PutImpl( const SfxPoolItem&, sal_uInt16 nWhich, bool bPassingOwnership ) override;
};