summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-13 11:29:37 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:08:27 +0200
commit96bd77de5ad7b7a13f7e48e0f95c05ef49255aa0 (patch)
tree4c79c57712124a8589c9e6579b6ec7fec9200c3b /configmgr
parent3f65724ec5fc92d5a0078a99932358ef7091435c (diff)
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 5
- Revise uses of getSomething to use getFromUnoTunnel Where that is impossible, use getSomething_cast to unify casting, and minimize number of places doing low-level transformations. The change keeps the existing tunnel references that last for the duration of the pointers' life, because sometimes destroying such reference may destroy the pointed object, and result in use after free. Change-Id: I291c33223582c34cd2c763aa8aacf0ae899ca4c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122101 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/access.cxx10
1 files changed, 2 insertions, 8 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 816262d3f812..dc16b0211ade 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/uno/XWeak.hpp>
#include <com/sun/star/util/ElementChange.hpp>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/lok.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <cppu/unotype.hxx>
@@ -2156,14 +2157,7 @@ void Access::checkKnownProperty(OUString const & descriptor) {
rtl::Reference< ChildAccess > Access::getFreeSetMember(
css::uno::Any const & value)
{
- rtl::Reference< ChildAccess > freeAcc;
- css::uno::Reference< css::lang::XUnoTunnel > tunnel;
- value >>= tunnel;
- if (tunnel.is()) {
- freeAcc.set(
- reinterpret_cast< ChildAccess * >(
- tunnel->getSomething(ChildAccess::getUnoTunnelId())));
- }
+ rtl::Reference< ChildAccess > freeAcc = comphelper::getFromUnoTunnel<ChildAccess>(value);
if (!freeAcc.is() || freeAcc->getParentAccess().is() ||
(freeAcc->isInTransaction() &&
freeAcc->getRootAccess() != getRootAccess()))