[Libreoffice] prevent the creation of lockfiles during unit tests

Stephan Bergmann sbergman at redhat.com
Fri Jan 13 00:05:18 PST 2012


On 01/13/2012 05:08 AM, Markus Mohrhard wrote:
> I did not push that patch directly because I'm not sure if we really
> want to introduce another registry entry for this.

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());
> }

(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?

Stephan


More information about the LibreOffice mailing list