[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - vbahelper/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 14 13:26:32 UTC 2019


 vbahelper/source/vbahelper/vbaapplicationbase.cxx |   14 ++++++++++++--
 vbahelper/source/vbahelper/vbadocumentsbase.cxx   |   20 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 81d6fbf3acaac13180424740a4be996bacf2aba7
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Aug 14 15:46:16 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Aug 14 16:25:30 2019 +0300

    Try harder to avoid exceptions screwing stuff up for OLE clients
    
    Change-Id: I5e9ae8669c4f5c561a09f5f21f11a675a40e5929

diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 0c67ea1a4fb9..1a9d3383af9c 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -241,8 +241,18 @@ sal_Bool SAL_CALL VbaApplicationBase::getInteractive()
     uno::Reference< frame::XModel > xModel = getCurrentDocument();
     if (!xModel.is())
         return true;
-    uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
-    uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW );
+
+    uno::Reference< frame::XController > xController( xModel->getCurrentController() );
+    if (!xController.is())
+        return true;
+
+    uno::Reference< frame::XFrame > xFrame( xController->getFrame() );
+    if (!xFrame.is())
+        return true;
+
+    uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY );
+    if (!xWindow.is())
+        return true;
 
     return xWindow->isEnabled();
 }
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index b948cc44bf94..78c461b97164 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -224,7 +224,15 @@ uno::Any VbaDocumentsBase::createDocument()
     // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened)
     uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY );
     bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating();
-    bool bInteractive = !xApplication.is() || xApplication->getInteractive();
+    bool bInteractive = true;
+
+    try
+    {
+        bInteractive = !xApplication.is() || xApplication->getInteractive();
+    }
+    catch( const uno::Exception& )
+    {
+    }
 
     uno::Reference< frame::XDesktop2 > xLoader = frame::Desktop::create(mxContext);
     OUString sURL;
@@ -257,7 +265,15 @@ uno::Any VbaDocumentsBase::openDocument( const OUString& rFileName, const uno::A
     // #163808# determine state of Application.ScreenUpdating and Application.Interactive symbols (before new document is opened)
     uno::Reference< XApplicationBase > xApplication( Application(), uno::UNO_QUERY );
     bool bScreenUpdating = !xApplication.is() || xApplication->getScreenUpdating();
-    bool bInteractive = !xApplication.is() || xApplication->getInteractive();
+    bool bInteractive = true;
+
+    try
+    {
+        bInteractive = !xApplication.is() || xApplication->getInteractive();
+    }
+    catch( const uno::Exception& )
+    {
+    }
 
     // we need to detect if this is a URL, if not then assume it's a file path
         OUString aURL;


More information about the Libreoffice-commits mailing list