diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-07-04 15:51:02 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-07-04 23:04:00 +0200 |
commit | a9303d85a4f201a42322e8e4ce5ebe6e6ca728b0 (patch) | |
tree | dd55c9ce5d9d59d92fcc93130316f5a4e96810ea /include/editeng | |
parent | 8d69ca2d310de2e6275b93b4fd6cd40f05e9e84e (diff) |
Make brittle SortedAutoCompleteStrings ownership handling more explicit
Change-Id: Ieaf2231a84d97528bb1b9a410c4ee0c38966dd27
Reviewed-on: https://gerrit.libreoffice.org/56950
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/editeng')
-rw-r--r-- | include/editeng/swafopt.hxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx index e8d7d3a6facf..f3b34adb32a7 100644 --- a/include/editeng/swafopt.hxx +++ b/include/editeng/swafopt.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_EDITENG_SWAFOPT_HXX #define INCLUDED_EDITENG_SWAFOPT_HXX +#include <sal/config.h> + +#include <config_global.h> #include <editeng/editengdllapi.h> #include <o3tl/sorted_vector.hxx> #include <rtl/ustring.hxx> @@ -52,8 +55,23 @@ struct CompareAutoCompleteString class SortedAutoCompleteStrings : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString> { + bool owning_; + + void operator =(SortedAutoCompleteStrings) = delete; + +#if !HAVE_CPP_GUARANTEED_COPY_ELISION +public: +#endif + // For createNonOwningCopy only: + SortedAutoCompleteStrings(SortedAutoCompleteStrings const & other): + sorted_vector(other), owning_(false) {} + public: - ~SortedAutoCompleteStrings() { DeleteAndDestroyAll(); } + SortedAutoCompleteStrings(): owning_(true) {} + + ~SortedAutoCompleteStrings() { if (owning_) DeleteAndDestroyAll(); } + + SortedAutoCompleteStrings createNonOwningCopy() const { return *this; } }; } // namespace editeng |