[Libreoffice] prevent the creation of lockfiles during unit tests

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Jan 13 03:52:08 PST 2012


Hello Stephan

> No idea about that either (I think Michael Stahl has previously been exposed
> heavily to locking, maybe he has some input), just two comments on the
> patch:
>
>> +bool IsLockingUsed()
>> +{
>> +    bool bLocking = true;
>> +    try
>> +    {
>> +
>> +        uno::Reference< uno::XInterface > xCommonConfig =
>> ::comphelper::ConfigurationHelper::openConfig(
>> +                            ::comphelper::getProcessServiceFactory(),
>> +                            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
>> "/org.openoffice.Office.Common" ) ),
>> +                            ::comphelper::ConfigurationHelper::E_STANDARD
>> );
>> +        if ( !xCommonConfig.is() )
>> +            throw uno::RuntimeException();
>> +
>> +        ::comphelper::ConfigurationHelper::readRelativeKey(
>> +                xCommonConfig,
>> +                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" )
>> ),
>> +                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
>> "UseLocking" ) ) ) >>= bLocking;
>> +    }
>> +    catch( const uno::Exception& )
>> +    {
>> +    }
>> +
>> +    return bLocking;
>> +}
>
>
> can be reduced to
>
>> #include "officecfg/Office/Common.hxx"
>>
>> bool IsLockingUsed()
>> {
>>    return officecfg::Office::Common::Misc::UseLocking::get(
>>        comphelper::getProcessComponentContext());
>> }

Wow that looks much better.
>
>
> (I haven't announced this new C++ API yet, as some issues about
> change-notification are not yet completely thought out for it.  Shame on me,
> should really do that soon.)
>
> And
>
>> + <oor:component-data oor:name="Common"
>> oor:package="org.openoffice.Office">
>> +  <node oor:name="Misc">
>> +    <prop oor:name="UseDocumentSystemFileLocking">
>> +      <value>false</value>
>> +    </prop>
>> +    <prop oor:name="UseDocumentOOoLockFile">
>> +      <value>false</value>
>> +    </prop>
>> +  </node>
>> + </oor:component-data>
>
>
> should instead set "UseLocking" to false, right?
>

Oh yes of course. That happens if you're editing both the file in test
and the copy in solver ;)


More information about the LibreOffice mailing list