Kaydet (Commit) 2f1eed48 authored tarafından Caolán McNamara's avatar Caolán McNamara

createNonDocMSPs->ensureNonDocMSPs

put the double-lockery into ensureNonDocMSPs and
the contents into a new createNonDocMSPs

Change-Id: Id09c933396e1a6ae1c45be79131a75729b16932b
üst 316a5574
...@@ -105,7 +105,7 @@ ActiveMSPList::getMSPFromAnyContext( const Any& aContext ) ...@@ -105,7 +105,7 @@ ActiveMSPList::getMSPFromAnyContext( const Any& aContext )
return msp; return msp;
} }
createNonDocMSPs(); ensureNonDocMSPs();
return m_hMsps[ shareDirString ]; return m_hMsps[ shareDirString ];
} }
...@@ -264,22 +264,9 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception ) ...@@ -264,22 +264,9 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception )
} }
} }
void void
ActiveMSPList::createNonDocMSPs() ActiveMSPList::createNonDocMSPs()
{ {
static bool created = false;
if ( created )
{
return;
}
else
{
::osl::MutexGuard guard( m_mutex );
if ( created )
{
return;
}
// do creation of user and share MSPs here // do creation of user and share MSPs here
OUString serviceName("com.sun.star.script.provider.MasterScriptProvider"); OUString serviceName("com.sun.star.script.provider.MasterScriptProvider");
Sequence< Any > args(1); Sequence< Any > args(1);
...@@ -298,10 +285,26 @@ ActiveMSPList::createNonDocMSPs() ...@@ -298,10 +285,26 @@ ActiveMSPList::createNonDocMSPs()
Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY ); Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid // should check if provider reference is valid
m_hMsps[ bundledDirString ] = bundledMsp; m_hMsps[ bundledDirString ] = bundledMsp;
}
void
ActiveMSPList::ensureNonDocMSPs()
{
static bool created = false;
if ( created )
{
return;
}
else
{
::osl::MutexGuard guard( m_mutex );
if ( created )
{
return;
}
createNonDocMSPs();
created = true; created = true;
} }
} }
......
...@@ -88,6 +88,7 @@ private: ...@@ -88,6 +88,7 @@ private:
return createNewMSP( css::uno::makeAny( context ) ); return createNewMSP( css::uno::makeAny( context ) );
} }
void ensureNonDocMSPs();
void createNonDocMSPs(); void createNonDocMSPs();
Msp_hash m_hMsps; Msp_hash m_hMsps;
ScriptComponent_map m_mScriptComponents; ScriptComponent_map m_mScriptComponents;
......
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