summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 13:42:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 15:55:46 +0100
commit25298930bc86d1a449a7e5b139d65e49f695f8c1 (patch)
treeb3f28ef6b18b12347694a637b6785ecb5eedc1fe /cppuhelper
parent1edaee2f03bce0efa409c592919458658d0aa751 (diff)
loplugin:flatten in canvas..cui
Change-Id: I208767eaa60d913fe2882403f1f9351eb08256f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/servicemanager.cxx63
1 files changed, 32 insertions, 31 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 57a3b646858e..6e2f12813445 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -1622,37 +1622,38 @@ bool cppuhelper::ServiceManager::insertExtraData(Data const & extra) {
}
//TODO: Updating the component context singleton data should be part of the
// atomic service manager update:
- if (!extra.singletons.empty()) {
- assert(context_.is());
- css::uno::Reference< css::container::XNameContainer > cont(
- context_, css::uno::UNO_QUERY_THROW);
- for (const auto& [rName, rImpls] : extra.singletons)
- {
- OUString name("/singletons/" + rName);
- //TODO: Update should be atomic:
- try {
- cont->removeByName(name + "/arguments");
- } catch (const css::container::NoSuchElementException &) {}
- assert(!rImpls.empty());
- assert(rImpls[0]);
- SAL_INFO_IF(
- rImpls.size() > 1, "cppuhelper",
- "Arbitrarily choosing " << rImpls[0]->name
- << " among multiple implementations for singleton "
- << rName);
- try {
- cont->insertByName(
- name + "/service", css::uno::Any(rImpls[0]->name));
- } catch (css::container::ElementExistException &) {
- cont->replaceByName(
- name + "/service", css::uno::Any(rImpls[0]->name));
- }
- try {
- cont->insertByName(name, css::uno::Any());
- } catch (css::container::ElementExistException &) {
- SAL_INFO("cppuhelper", "Overwriting singleton " << rName);
- cont->replaceByName(name, css::uno::Any());
- }
+ if (extra.singletons.empty())
+ return true;
+
+ assert(context_.is());
+ css::uno::Reference< css::container::XNameContainer > cont(
+ context_, css::uno::UNO_QUERY_THROW);
+ for (const auto& [rName, rImpls] : extra.singletons)
+ {
+ OUString name("/singletons/" + rName);
+ //TODO: Update should be atomic:
+ try {
+ cont->removeByName(name + "/arguments");
+ } catch (const css::container::NoSuchElementException &) {}
+ assert(!rImpls.empty());
+ assert(rImpls[0]);
+ SAL_INFO_IF(
+ rImpls.size() > 1, "cppuhelper",
+ "Arbitrarily choosing " << rImpls[0]->name
+ << " among multiple implementations for singleton "
+ << rName);
+ try {
+ cont->insertByName(
+ name + "/service", css::uno::Any(rImpls[0]->name));
+ } catch (css::container::ElementExistException &) {
+ cont->replaceByName(
+ name + "/service", css::uno::Any(rImpls[0]->name));
+ }
+ try {
+ cont->insertByName(name, css::uno::Any());
+ } catch (css::container::ElementExistException &) {
+ SAL_INFO("cppuhelper", "Overwriting singleton " << rName);
+ cont->replaceByName(name, css::uno::Any());
}
}
return true;