summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-25 11:30:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-25 14:15:56 +0200
commit87db52ab1e9c39ad8319aaf9c0c59d4435b6ffb5 (patch)
tree64795c67bc154c4d5bcf4287139d1db7e11c9a6c /comphelper
parent139cffc531277b57bae8e272fef13af00ace5366 (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 'comphelper')
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx6
-rw-r--r--comphelper/source/misc/instancelocker.cxx7
-rw-r--r--comphelper/source/misc/storagehelper.cxx4
3 files changed, 11 insertions, 6 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index f1281132214e..094597fe6d06 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -1477,9 +1477,9 @@ bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< embed::
// if this method is used as part of SaveCompleted the object must stay unmodified after execution
try
{
- if (auto xModif = xObj->getComponent().query<util::XModifiable>() )
- if ( xModif->isModified() )
- xModif->setModified( false );
+ uno::Reference< util::XModifiable > xModif( xObj->getComponent(), uno::UNO_QUERY_THROW );
+ if ( xModif->isModified() )
+ xModif->setModified( false );
}
catch (const uno::Exception&)
{
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index f545ff1480bf..84c8054ecbb8 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -238,8 +238,13 @@ void OLockListener::Dispose()
if ( nMode & embed::Actions::PREVENT_TERMINATION )
{
- if (auto xDesktop = xInstance.query<frame::XDesktop>() )
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop( xInstance, uno::UNO_QUERY_THROW );
xDesktop->removeTerminateListener( static_cast< frame::XTerminateListener* >( this ) );
+ }
+ catch( uno::Exception& )
+ {}
}
}
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index b04c3c9ec58b..9d3dbcd22732 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -679,8 +679,8 @@ OUString OStorageHelper::GetODFVersionFromStorage(const uno::Reference<embed::XS
OUString aODFVersion;
try
{
- if (auto xPropSet = xStorage.query<beans::XPropertySet>())
- xPropSet->getPropertyValue("Version") >>= aODFVersion;
+ uno::Reference<beans::XPropertySet> xPropSet(xStorage, uno::UNO_QUERY_THROW);
+ xPropSet->getPropertyValue("Version") >>= aODFVersion;
}
catch (uno::Exception&)
{