diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-04-25 16:44:01 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-05-31 15:46:24 +0300 |
commit | 1b55ed02a4c5b7f6d1ff39220af6e7624995f9d3 (patch) | |
tree | 5703ad35e4bd5af7b2d97e1fd41f88d1be3ac182 /vbahelper | |
parent | fad591f79ef175e62bb1ea8ce861513d518c1518 (diff) |
Avoid a SolarMutex assertion failure in some use cases from Automation
For instance when opening a Calc Document through ooo::vba::excel::
XWorkbooks::Open(). Instead just let the function return null. It does
seem that callers are prepared for that.
Change-Id: I7136133155f95a696b5ed3e661a9adb98396c9c5
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbahelper.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index c34559b769f6..187e88d5713b 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column:100 -*- */ /* * This file is part of the LibreOffice project. * @@ -39,6 +39,7 @@ #include <ooo/vba/msforms/XShape.hpp> +#include <comphelper/automationinvokedzone.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/objsh.hxx> @@ -1122,6 +1123,12 @@ uno::Reference< XHelperInterface > getUnoDocModule( const OUString& aModName, Sf if ( pShell ) { OUString sProj( "Standard" ); + // GetBasicManager() causes a SolarMutex assertion failure in some use cases from + // Automation, at least when opening a Calc Document through ooo::vba::excel:: + // XWorkbooks::Open(). Let's see if this check is a good way around that. It does seem that + // callers are prepared for this to return null? + if (comphelper::Automation::AutomationInvokedZone::isActive()) + return xIf; BasicManager* pBasMgr = pShell->GetBasicManager(); if ( pBasMgr && !pBasMgr->GetName().isEmpty() ) sProj = pBasMgr->GetName(); |