diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-25 11:30:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-25 14:15:56 +0200 |
commit | 87db52ab1e9c39ad8319aaf9c0c59d4435b6ffb5 (patch) | |
tree | 64795c67bc154c4d5bcf4287139d1db7e11c9a6c /unotools | |
parent | 139cffc531277b57bae8e272fef13af00ace5366 (diff) |
Revert "use more Reference::query instead of UNO_QUERY_THROW"
This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd.
sberg noticed that there is a difference now:
there's a subtle difference now, in that if y was null originally, it would have thrown a (caught) exception, whereas now it will crash in the y.query<X>() call.
Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/confignode.cxx | 9 | ||||
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 8 | ||||
-rw-r--r-- | unotools/source/config/useroptions.cxx | 8 |
3 files changed, 18 insertions, 7 deletions
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index cf5dcb0e64ae..93b89532072d 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -146,8 +146,15 @@ namespace utl OUString OConfigurationNode::getLocalName() const { OUString sLocalName; - if (auto xNamed = m_xDirectAccess.query<XNamed>() ) + try + { + Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); sLocalName = xNamed->getName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("unotools"); + } return sLocalName; } diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 6c3f625dd76d..0b39db9172ef 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1016,11 +1016,9 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const uno::Sequence< OUString > aResult; try { - if (auto xNA = GetMainUpdateAccess().query<container::XNameAccess>() ) - { - xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); - xNA->getByName( "DisabledDictionaries" ) >>= aResult; - } + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW ); + xNA->getByName( "DisabledDictionaries" ) >>= aResult; } catch (uno::Exception &) { diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 4cfc3f125358..1e181e8813d6 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -117,8 +117,14 @@ void SvtUserOptions::ChangeListener::changesOccurred (util::ChangesEvent const& void SvtUserOptions::ChangeListener::disposing (lang::EventObject const& rSource) { - if (auto xChgNot = rSource.Source.query<util::XChangesNotifier>()) + try + { + uno::Reference<util::XChangesNotifier> xChgNot(rSource.Source, uno::UNO_QUERY_THROW); xChgNot->removeChangesListener(this); + } + catch (uno::Exception&) + { + } } SvtUserOptions::Impl::Impl() : |