Kaydet (Commit) e07cefb4 authored tarafından Matúš Kukan's avatar Matúš Kukan

webdav: Do not call into DAVResourceAccess with mutex locked.

This commit cherry-picks 0c350011
for serf webdav version.

Change-Id: I108b0068cad847bf4947ece5e690f789ef034ae9
üst a5958793
...@@ -1472,8 +1472,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( ...@@ -1472,8 +1472,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
} }
catch ( DAVException const & e ) catch ( DAVException const & e )
{ {
bNetworkAccessAllowed bNetworkAccessAllowed = bNetworkAccessAllowed &&
= shouldAccessNetworkAfterException( e ); shouldAccessNetworkAfterException( e );
if ( !bNetworkAccessAllowed ) if ( !bNetworkAccessAllowed )
{ {
...@@ -3329,9 +3329,12 @@ const Content::ResourceType & Content::getResourceType( ...@@ -3329,9 +3329,12 @@ const Content::ResourceType & Content::getResourceType(
bool * networkAccessAllowed ) bool * networkAccessAllowed )
throw ( uno::Exception ) throw ( uno::Exception )
{ {
if ( m_eResourceType == UNKNOWN )
{ {
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::MutexGuard g(m_aMutex);
if (m_eResourceType != UNKNOWN) {
return m_eResourceType;
}
}
ResourceType eResourceType = UNKNOWN; ResourceType eResourceType = UNKNOWN;
...@@ -3358,6 +3361,7 @@ const Content::ResourceType & Content::getResourceType( ...@@ -3358,6 +3361,7 @@ const Content::ResourceType & Content::getResourceType(
// TODO - is this really only one? // TODO - is this really only one?
if ( resources.size() == 1 ) if ( resources.size() == 1 )
{ {
osl::MutexGuard g(m_aMutex);
m_xCachedProps.reset( m_xCachedProps.reset(
new CachableContentProperties( resources[ 0 ] ) ); new CachableContentProperties( resources[ 0 ] ) );
m_xCachedProps->containsAllNames( m_xCachedProps->containsAllNames(
...@@ -3388,7 +3392,15 @@ const Content::ResourceType & Content::getResourceType( ...@@ -3388,7 +3392,15 @@ const Content::ResourceType & Content::getResourceType(
cancelCommandExecution( e, uno::Reference< ucb::XCommandEnvironment >() ); cancelCommandExecution( e, uno::Reference< ucb::XCommandEnvironment >() );
} }
} }
osl::MutexGuard g(m_aMutex);
if (m_eResourceType == UNKNOWN) {
m_eResourceType = eResourceType; m_eResourceType = eResourceType;
} else {
SAL_WARN_IF(
eResourceType != m_eResourceType, "ucb.ucp.webdav",
"different resource types for <" << rResAccess->getURL() << ">: "
<< +eResourceType << " vs. " << +m_eResourceType);
} }
return m_eResourceType; return m_eResourceType;
} }
......
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