summaryrefslogtreecommitdiff
path: root/vbahelper/source/vbahelper/vbahelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vbahelper/source/vbahelper/vbahelper.cxx')
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index d6be56bd8bd9..f53a5fd2e540 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>
@@ -1121,6 +1122,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();