Kaydet (Commit) 1b55ed02 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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
üst fad591f7
/* -*- 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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment