summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-11-14 12:54:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-11-14 18:19:24 +0100
commit04a8f3a42c0cefa67aeff00c6dea256f5be67449 (patch)
tree329ffd8ce086d510c730c9bcc730e01ea3a031f5 /stoc
parent1ff360c29c99a570bfe59c69d8f589d4f2b59135 (diff)
Destruction of Registry and RegitsryKey isn't MT-safe
...as the underlying ORegistry and ORegKey modify their ref counts outside any locked mutexes. For example, <https://ci.libreoffice.org/job/lo_ubsan/2572/> had failed during CustomTarget_odk/build-examples_java with > ==402==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d00035d920 at pc 0x7f379ce963d9 bp 0x7ffe74b1ac60 sp 0x7ffe74b1ac58 > READ of size 4 at 0x60d00035d920 thread T0 > #0 0x7f379ce963d8 in ORegistry::acquire() /registry/source/regimpl.hxx:49:18 > #1 0x7f379ce947a3 in acquire(void*) /registry/source/registry.cxx:38:15 > #2 0x7f375ee9287e in Registry::operator=(Registry const&) /include/registry/registry.hxx:961:9 > #3 0x7f375ee92654 in RegistryKey::setRegistry(Registry const&) /include/registry/registry.hxx:647:20 > #4 0x7f375ee91d66 in Registry::openRootKey(RegistryKey&) /include/registry/registry.hxx:979:18 > #5 0x7f375ee725da in (anonymous namespace)::SimpleRegistry::getRootKey() /stoc/source/simpleregistry/simpleregistry.cxx:889:30 > #6 0x7f375ee73a56 in non-virtual thunk to (anonymous namespace)::SimpleRegistry::getRootKey() /stoc/source/simpleregistry/simpleregistry.cxx > #7 0x7f37828e142c in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) /bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5 > #8 0x7f37828db812 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13 > #9 0x7f37828d8668 in unoInterfaceProxyDispatch /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13 > #10 0x7f375cfebc05 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:236:13 > #11 0x7f375cfe5a46 in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:79:26 > #12 0x7f375d0ae662 in request /binaryurp/source/reader.cxx:86:9 > #13 0x7f37b5cf5a2b in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17 > #14 0x7f37b5d44637 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) /cppu/source/threadpool/threadpool.cxx:304:33 > #15 0x7f37b5d468d4 in uno_threadpool_enter /cppu/source/threadpool/threadpool.cxx:408:33 > #16 0x7f375cf144fa in binaryurp::Bridge::makeCall(rtl::OUString const&, com::sun::star::uno::TypeDescription const&, bool, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >&&, binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) /binaryurp/source/bridge.cxx:606:9 > #17 0x7f375d0aa130 in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const /binaryurp/source/proxy.cxx:169:18 > #18 0x7f375d0a82f4 in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const /binaryurp/source/proxy.cxx:102:13 > #19 0x7f375d0a80cf in proxy_dispatchInterface /binaryurp/source/proxy.cxx:61:36 > #20 0x7f3782881fff in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, _typelib_TypeDescription const*, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void**, void**, void**, unsigned long*) /bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191:5 > #21 0x7f378287ef40 in cpp_vtable_call /bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389:28 > #22 0x7f378292d60d in privateSnippetExecutor (/instdir/program/libgcc3_uno.so+0x13960d) > #23 0x7f3774fd11c7 in dp_registry::backend::component::(anonymous namespace)::BackendImpl::ComponentPackageImpl::processPackage_(osl::ResettableGuard<osl::Mutex>&, bool, bool, rtl::Reference<dp_misc::AbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/component/dp_component.cxx:1376:17 > #24 0x7f37750f1c11 in dp_registry::backend::Package::processPackage_impl(bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:631:17 > #25 0x7f37750f3f4b in dp_registry::backend::Package::registerPackage(unsigned char, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:688:5 > #26 0x7f3775206b47 in dp_registry::backend::bundle::(anonymous namespace)::BackendImpl::PackageImpl::processPackage_(osl::ResettableGuard<osl::Mutex>&, bool, bool, rtl::Reference<dp_misc::AbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/package/dp_package.cxx:805:27 > #27 0x7f37750f1c11 in dp_registry::backend::Package::processPackage_impl(bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:631:17 > #28 0x7f37750f3f4b in dp_registry::backend::Package::registerPackage(unsigned char, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:688:5 > #29 0x7f3774e55b17 in dp_manager::ExtensionManager::activateExtension(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> > const&, bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:473:23 > #30 0x7f3774e54ab4 in dp_manager::ExtensionManager::activateExtension(rtl::OUString const&, rtl::OUString const&, bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:423:5 > #31 0x7f3774e5fa40 in dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:723:21 > #32 0x7f3774e62b64 in non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx > #33 0x7f37ba706dcf in unopkg_main /desktop/source/pkgchk/unopkg/unopkg_app.cxx:429:40 > #34 0x501298 in sal_main /desktop/source/pkgchk/unopkg/unopkg_main.c:24:31 > #35 0x501276 in main /desktop/source/pkgchk/unopkg/unopkg_main.c:24:1 > > 0x60d00035d920 is located 0 bytes inside of 136-byte region [0x60d00035d920,0x60d00035d9a8) > freed by thread T6 (cppu_threadpool) here: > #0 0x4fe928 in operator delete(void*, unsigned long) /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172 > #1 0x7f379ce94875 in release(void*) /registry/source/registry.cxx:47:9 > #2 0x7f375ee8e6b5 in Registry::~Registry() /include/registry/registry.hxx:955:13 > #3 0x7f375ee92582 in RegistryKey::~RegistryKey() /include/registry/registry.hxx:655:5 > #4 0x7f375ee744e6 in (anonymous namespace)::Key::~Key() /stoc/source/simpleregistry/simpleregistry.cxx:101:7 > #5 0x7f375ee74558 in (anonymous namespace)::Key::~Key() /stoc/source/simpleregistry/simpleregistry.cxx:101:7 > #6 0x7f37b53a682a in cppu::OWeakObject::release() /cppuhelper/source/weak.cxx:230:9 > #7 0x7f375ec5c009 in cppu::WeakImplHelper<com::sun::star::registry::XRegistryKey>::release() /include/cppuhelper/implbase.hxx:115:66 > #8 0x7f37828f0054 in freeUnoInterfaceProxy /bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:19 > #9 0x7f37b5ee924d in (anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1]) /cppu/source/uno/lbenv.cxx:372:17 > #10 0x7f37b5e8fcbc in s_environment_invoke_v(_uno_Environment*, _uno_Environment*, void (*)(__va_list_tag (*) [1]), __va_list_tag (*) [1]) /cppu/source/uno/EnvStack.cxx:293:9 > #11 0x7f37b5e8fa04 in uno_Environment_invoke_v /cppu/source/uno/EnvStack.cxx:312:5 > #12 0x7f37b5e9016a in uno_Environment_invoke /cppu/source/uno/EnvStack.cxx:321:5 > #13 0x7f37b5ec2dc5 in (anonymous namespace)::defenv_revokeInterface(_uno_ExtEnvironment*, void*) /cppu/source/uno/lbenv.cxx:426:5 > #14 0x7f37828f0f08 in releaseProxy /bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:78:9 > #15 0x7f375cf305c5 in com::sun::star::uno::UnoInterfaceReference::~UnoInterfaceReference() /include/uno/dispatcher.hxx:107:9 > #16 0x7f375cf0f387 in binaryurp::Bridge::releaseStub(rtl::OUString const&, com::sun::star::uno::TypeDescription const&) /binaryurp/source/bridge.cxx:514:1 > #17 0x7f375cfe8b9b in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:138:18 > #18 0x7f375cfe5a46 in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:79:26 > #19 0x7f375d0ae662 in request /binaryurp/source/reader.cxx:86:9 > #20 0x7f37b5cf5a2b in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17 > #21 0x7f37b5d161c4 in cppu_threadpool::ORequestThread::run() /cppu/source/threadpool/thread.cxx:165:31 > #22 0x7f37b5d20fc4 in threadFunc /include/osl/thread.hxx:189:15 > #23 0x7f37bb9d9f0f in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:265:9 > #24 0x7f37b9e35ea4 in start_thread /usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:307 The SimpleRegistry UNO implementation appears to be the only one of the few remaining uses of the legacy registry functionality that suffers from this issue, so address things there and keep the registry functionality itself non- MT-safe. Change-Id: I5a87f1c66d838603672f6dfd19e6d1b617fbe691 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142713 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx89
1 files changed, 50 insertions, 39 deletions
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index e66ecf8580a0..82e53417e2a3 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -21,6 +21,7 @@
#include <cstdlib>
#include <mutex>
+#include <optional>
#include <utility>
#include <vector>
@@ -58,7 +59,12 @@ class SimpleRegistry:
css::registry::XSimpleRegistry, css::lang::XServiceInfo >
{
public:
- SimpleRegistry() {}
+ SimpleRegistry(): registry_(Registry()) {}
+
+ ~SimpleRegistry() {
+ std::scoped_lock guard(mutex_);
+ registry_.reset();
+ }
std::mutex mutex_;
@@ -95,7 +101,7 @@ private:
return names;
}
- Registry registry_;
+ std::optional<Registry> registry_;
};
class Key: public cppu::WeakImplHelper< css::registry::XRegistryKey > {
@@ -105,6 +111,11 @@ public:
RegistryKey const & key):
registry_(std::move(registry)), key_(key) {}
+ ~Key() {
+ std::scoped_lock guard(registry_->mutex_);
+ key_.reset();
+ }
+
private:
virtual OUString SAL_CALL getKeyName() override;
@@ -175,23 +186,23 @@ private:
virtual OUString SAL_CALL getResolvedName(OUString const & aKeyName) override;
rtl::Reference< SimpleRegistry > registry_;
- RegistryKey key_;
+ std::optional<RegistryKey> key_;
};
OUString Key::getKeyName() {
std::scoped_lock guard(registry_->mutex_);
- return key_.getName();
+ return key_->getName();
}
sal_Bool Key::isReadOnly()
{
std::scoped_lock guard(registry_->mutex_);
- return key_.isReadOnly();
+ return key_->isReadOnly();
}
sal_Bool Key::isValid() {
std::scoped_lock guard(registry_->mutex_);
- return key_.isValid();
+ return key_->isValid();
}
css::registry::RegistryKeyType Key::getKeyType(OUString const & )
@@ -204,7 +215,7 @@ css::registry::RegistryValueType Key::getValueType()
std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
- RegError err = key_.getValueInfo(OUString(), &type, &size);
+ RegError err = key_->getValueInfo(OUString(), &type, &size);
switch (err) {
case RegError::NO_ERROR:
break;
@@ -244,7 +255,7 @@ sal_Int32 Key::getLongValue()
{
std::scoped_lock guard(registry_->mutex_);
sal_Int32 value;
- RegError err = key_.getValue(OUString(), &value);
+ RegError err = key_->getValue(OUString(), &value);
switch (err) {
case RegError::NO_ERROR:
break;
@@ -265,7 +276,7 @@ sal_Int32 Key::getLongValue()
void Key::setLongValue(sal_Int32 value)
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.setValue(
+ RegError err = key_->setValue(
OUString(), RegValueType::LONG, &value, sizeof (sal_Int32));
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -279,7 +290,7 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
{
std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Int32 > list;
- RegError err = key_.getLongListValue(OUString(), list);
+ RegError err = key_->getLongListValue(OUString(), list);
switch (err) {
case RegError::NO_ERROR:
break;
@@ -315,7 +326,7 @@ css::uno::Sequence< sal_Int32 > Key::getLongListValue()
void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.setLongListValue(
+ RegError err = key_->setLongListValue(
OUString(), seqValue.getConstArray(), static_cast< sal_uInt32 >(seqValue.getLength()));
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -330,7 +341,7 @@ OUString Key::getAsciiValue()
std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
- RegError err = key_.getValueInfo(OUString(), &type, &size);
+ RegError err = key_->getValueInfo(OUString(), &type, &size);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
@@ -358,7 +369,7 @@ OUString Key::getAsciiValue()
static_cast< OWeakObject * >(this));
}
std::vector< char > list(size);
- err = key_.getValue(OUString(), list.data());
+ err = key_->getValue(OUString(), list.data());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getAsciiValue:"
@@ -402,7 +413,7 @@ void Key::setAsciiValue(OUString const & value)
" value not UTF-16",
static_cast< OWeakObject * >(this));
}
- RegError err = key_.setValue(
+ RegError err = key_->setValue(
OUString(), RegValueType::STRING,
const_cast< char * >(utf8.getStr()), utf8.getLength() + 1);
// +1 for terminating null (error in underlying registry.cxx)
@@ -418,7 +429,7 @@ css::uno::Sequence< OUString > Key::getAsciiListValue()
{
std::scoped_lock guard(registry_->mutex_);
RegistryValueList< char * > list;
- RegError err = key_.getStringListValue(OUString(), list);
+ RegError err = key_->getStringListValue(OUString(), list);
switch (err) {
case RegError::NO_ERROR:
break;
@@ -491,7 +502,7 @@ void Key::setAsciiListValue(
{
list2.push_back(const_cast< char * >(rItem.getStr()));
}
- RegError err = key_.setStringListValue(
+ RegError err = key_->setStringListValue(
OUString(), list2.data(), static_cast< sal_uInt32 >(list2.size()));
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -507,7 +518,7 @@ OUString Key::getStringValue()
std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
- RegError err = key_.getValueInfo(OUString(), &type, &size);
+ RegError err = key_->getValueInfo(OUString(), &type, &size);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
@@ -536,7 +547,7 @@ OUString Key::getStringValue()
static_cast< OWeakObject * >(this));
}
std::vector< sal_Unicode > list(size);
- err = key_.getValue(OUString(), list.data());
+ err = key_->getValue(OUString(), list.data());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getStringValue:"
@@ -556,7 +567,7 @@ OUString Key::getStringValue()
void Key::setStringValue(OUString const & value)
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.setValue(
+ RegError err = key_->setValue(
OUString(), RegValueType::UNICODE,
const_cast< sal_Unicode * >(value.getStr()),
(value.getLength() + 1) * sizeof (sal_Unicode));
@@ -573,7 +584,7 @@ css::uno::Sequence< OUString > Key::getStringListValue()
{
std::scoped_lock guard(registry_->mutex_);
RegistryValueList< sal_Unicode * > list;
- RegError err = key_.getUnicodeListValue(OUString(), list);
+ RegError err = key_->getUnicodeListValue(OUString(), list);
switch (err) {
case RegError::NO_ERROR:
break;
@@ -616,7 +627,7 @@ void Key::setStringListValue(
list.reserve(seqValue.getLength());
std::transform(seqValue.begin(), seqValue.end(), std::back_inserter(list),
[](const OUString& rValue) -> sal_Unicode* { return const_cast<sal_Unicode*>(rValue.getStr()); });
- RegError err = key_.setUnicodeListValue(
+ RegError err = key_->setUnicodeListValue(
OUString(), list.data(), static_cast< sal_uInt32 >(list.size()));
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -632,7 +643,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
std::scoped_lock guard(registry_->mutex_);
RegValueType type;
sal_uInt32 size;
- RegError err = key_.getValueInfo(OUString(), &type, &size);
+ RegError err = key_->getValueInfo(OUString(), &type, &size);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
@@ -652,7 +663,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
static_cast< OWeakObject * >(this));
}
css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size));
- err = key_.getValue(OUString(), value.getArray());
+ err = key_->getValue(OUString(), value.getArray());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getBinaryValue:"
@@ -665,7 +676,7 @@ css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.setValue(
+ RegError err = key_->setValue(
OUString(), RegValueType::BINARY,
const_cast< sal_Int8 * >(value.getConstArray()),
static_cast< sal_uInt32 >(value.getLength()));
@@ -682,7 +693,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
{
std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
- RegError err = key_.openKey(aKeyName, key);
+ RegError err = key_->openKey(aKeyName, key);
switch (err) {
case RegError::NO_ERROR:
return new Key(registry_, key);
@@ -701,7 +712,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
{
std::scoped_lock guard(registry_->mutex_);
RegistryKey key;
- RegError err = key_.createKey(aKeyName, key);
+ RegError err = key_->createKey(aKeyName, key);
switch (err) {
case RegError::NO_ERROR:
return new Key(registry_, key);
@@ -718,7 +729,7 @@ css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
void Key::closeKey()
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.closeKey();
+ RegError err = key_->closeKey();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key closeKey:"
@@ -730,7 +741,7 @@ void Key::closeKey()
void Key::deleteKey(OUString const & rKeyName)
{
std::scoped_lock guard(registry_->mutex_);
- RegError err = key_.deleteKey(rKeyName);
+ RegError err = key_->deleteKey(rKeyName);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key deleteKey:"
@@ -744,7 +755,7 @@ Key::openKeys()
{
std::scoped_lock guard(registry_->mutex_);
RegistryKeyArray list;
- RegError err = key_.openSubKeys(OUString(), list);
+ RegError err = key_->openSubKeys(OUString(), list);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key openKeys:"
@@ -772,7 +783,7 @@ css::uno::Sequence< OUString > Key::getKeyNames()
{
std::scoped_lock guard(registry_->mutex_);
RegistryKeyNames list;
- RegError err = key_.getKeyNames(OUString(), list);
+ RegError err = key_->getKeyNames(OUString(), list);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getKeyNames:"
@@ -820,7 +831,7 @@ OUString Key::getResolvedName(OUString const & aKeyName)
{
std::scoped_lock guard(registry_->mutex_);
OUString resolved;
- RegError err = key_.getResolvedKeyName(aKeyName, resolved);
+ RegError err = key_->getResolvedKeyName(aKeyName, resolved);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry key getResolvedName:"
@@ -832,7 +843,7 @@ OUString Key::getResolvedName(OUString const & aKeyName)
OUString SimpleRegistry::getURL() {
std::scoped_lock guard(mutex_);
- return registry_.getName();
+ return registry_->getName();
}
void SimpleRegistry::open(
@@ -841,9 +852,9 @@ void SimpleRegistry::open(
std::scoped_lock guard(mutex_);
RegError err = (rURL.isEmpty() && bCreate)
? RegError::REGISTRY_NOT_EXISTS
- : registry_.open(rURL, bReadOnly ? RegAccessMode::READONLY : RegAccessMode::READWRITE);
+ : registry_->open(rURL, bReadOnly ? RegAccessMode::READONLY : RegAccessMode::READWRITE);
if (err == RegError::REGISTRY_NOT_EXISTS && bCreate) {
- err = registry_.create(rURL);
+ err = registry_->create(rURL);
}
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
@@ -855,13 +866,13 @@ void SimpleRegistry::open(
sal_Bool SimpleRegistry::isValid() {
std::scoped_lock guard(mutex_);
- return registry_.isValid();
+ return registry_->isValid();
}
void SimpleRegistry::close()
{
std::scoped_lock guard(mutex_);
- RegError err = registry_.close();
+ RegError err = registry_->close();
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.close:"
@@ -873,7 +884,7 @@ void SimpleRegistry::close()
void SimpleRegistry::destroy()
{
std::scoped_lock guard(mutex_);
- RegError err = registry_.destroy(OUString());
+ RegError err = registry_->destroy(OUString());
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.destroy:"
@@ -886,7 +897,7 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
{
std::scoped_lock guard(mutex_);
RegistryKey root;
- RegError err = registry_.openRootKey(root);
+ RegError err = registry_->openRootKey(root);
if (err != RegError::NO_ERROR) {
throw css::registry::InvalidRegistryException(
"com.sun.star.registry.SimpleRegistry.getRootKey:"
@@ -899,7 +910,7 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
sal_Bool SimpleRegistry::isReadOnly()
{
std::scoped_lock guard(mutex_);
- return registry_.isReadOnly();
+ return registry_->isReadOnly();
}
void SimpleRegistry::mergeKey(