summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-23 20:43:27 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-24 00:50:18 +0100
commit28616cf0989dab2ca2a1710c64f6fb1c1d78c584 (patch)
treec366c3cdd943907d8f93e2ad55172b0ca3aad079
parentcfd333f13f85eaf6eaf564e791b55a2092841376 (diff)
OInterfaceIteratorHelper3 always copies maData contents in ctor
while I think the idea is that the copy on write should only be done by OInterfaceContainerHelper3, i.e. that ownership really transfers to OInterfaceIteratorHelper3 and OInterfaceContainerHelper3 makes a new one if that turns out to be necessary Change-Id: I6e97e3b303f133edbbb35ac23f39cf5348ad49fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161257 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--include/comphelper/interfacecontainer3.hxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/comphelper/interfacecontainer3.hxx b/include/comphelper/interfacecontainer3.hxx
index 4b3d44bab69d..02f96658dcd2 100644
--- a/include/comphelper/interfacecontainer3.hxx
+++ b/include/comphelper/interfacecontainer3.hxx
@@ -63,7 +63,8 @@ public:
OInterfaceIteratorHelper3(OInterfaceContainerHelper3<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,12 +97,12 @@ template <class ListenerT>
const css::uno::Reference<ListenerT>& OInterfaceIteratorHelper3<ListenerT>::next()
{
nRemain--;
- return (*maData)[nRemain];
+ return (*std::as_const(maData))[nRemain];
}
template <class ListenerT> void OInterfaceIteratorHelper3<ListenerT>::remove()
{
- rCont.removeInterface((*maData)[nRemain]);
+ rCont.removeInterface((*std::as_const(maData))[nRemain]);
}
/**