summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-15 21:23:34 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-16 17:51:27 +0200
commita49c68354656dcdcef87d5c14c8f8f3e3391ec6f (patch)
tree112b341fb4d998772b03f707cd706248a1ed7814 /include/comphelper
parentf23633aa0adf5048b283e7bedb08f67198cff591 (diff)
remove unnecessary copying in OInterfaceContainerHelper4
caused by triggering make_unique in cow_wrappe when calling through non-const operator* Change-Id: I3191466f464d0f741a628afbe45b60f66f6af2c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134395 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/interfacecontainer4.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx
index 04b949575e7a..fe19bab4e43e 100644
--- a/include/comphelper/interfacecontainer4.hxx
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -63,7 +63,8 @@ public:
OInterfaceContainerHelper4<ListenerT>& rCont_)
: rCont(rCont_)
, maData(rCont.maData)
- , nRemain(maData->size())
+ // const_cast so we don't trigger make_unique via o3tl::cow_wrapper::operator->
+ , nRemain(std::as_const(maData)->size())
{
}
@@ -96,13 +97,13 @@ template <class ListenerT>
const css::uno::Reference<ListenerT>& OInterfaceIteratorHelper4<ListenerT>::next()
{
nRemain--;
- return (*maData)[nRemain];
+ return (*std::as_const(maData))[nRemain];
}
template <class ListenerT>
void OInterfaceIteratorHelper4<ListenerT>::remove(::std::unique_lock<::std::mutex>& rGuard)
{
- rCont.removeInterface(rGuard, (*maData)[nRemain]);
+ rCont.removeInterface(rGuard, (*std::as_const(maData))[nRemain]);
}
/**