diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-18 11:16:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-19 17:55:31 +0000 |
commit | bbe9d53fab5212040867adaa0cd6341d50ae244d (patch) | |
tree | 3ab61ed93c76bdca5dea979937f1105f5b3afb8e /sw/inc | |
parent | b09c70ec15b4f94688a19f72782c3dc627590c8c (diff) |
storing WeakReference in std::set is a bad idea
because if we allocate two things in the same location, we can subtlely
lose the second one.
Change-Id: I4dda5c738802da8544d280c020e059da63b5d71c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145779
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/unochart.hxx | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index d56b3356da0a..956d5f721e94 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SW_INC_UNOCHART_HXX #include <map> -#include <set> +#include <vector> #include <com/sun/star/chart2/data/XDataProvider.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> @@ -105,20 +105,11 @@ class SwChartDataProvider final : { // used to keep weak-references to all data-sequences of a single table - // see set definition below... - struct lt_DataSequenceRef - { - bool operator()( const unotools::WeakReference< SwChartDataSequence > & xWRef1, const unotools::WeakReference< SwChartDataSequence >& xWRef2 ) const - { - rtl::Reference< SwChartDataSequence > xRef1( xWRef1 ); - rtl::Reference< SwChartDataSequence > xRef2( xWRef2 ); - return xRef1.get() < xRef2.get(); - } - }; - typedef std::set< unotools::WeakReference < SwChartDataSequence >, lt_DataSequenceRef > Set_DataSequenceRef_t; + // see definition below... + typedef std::vector< unotools::WeakReference < SwChartDataSequence > > Vec_DataSequenceRef_t; // map of data-sequence sets for each table - typedef std::map< const SwTable *, Set_DataSequenceRef_t > Map_Set_DataSequenceRef_t; + typedef std::map< const SwTable *, Vec_DataSequenceRef_t > Map_Set_DataSequenceRef_t; // map of all data-sequences provided directly or indirectly (e.g. via // data-source) by this object. Since there is only one object of this type |