summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-07-04 15:51:02 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-07-04 23:04:00 +0200
commita9303d85a4f201a42322e8e4ce5ebe6e6ca728b0 (patch)
treedd55c9ce5d9d59d92fcc93130316f5a4e96810ea /include
parentreset submodules to their corresponding branch (diff)
downloadcore-a9303d85a4f201a42322e8e4ce5ebe6e6ca728b0.tar.gz
core-a9303d85a4f201a42322e8e4ce5ebe6e6ca728b0.zip
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')
-rw-r--r--include/editeng/swafopt.hxx20
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