[Libreoffice] Bug in main function libs-core/desktop/source/app/app.cxx ?

Lubos Lunak l.lunak at suse.cz
Thu Apr 28 05:08:45 PDT 2011


On Friday 22 of April 2011, Julien Nabet wrote:
> I think this line "nAcquireCount = Application::ReleaseSolarMutex() -
> 1;" should be added before the line 1850 :
> if ( !bTerminateRequested && !rCmdLineArgs.IsInvisible() &&)

 In the code before the wrong commit, the SolarMutex stuff surrounds the 
Application::PostUserEvent() calls, so I think it belongs before them. Not 
quite sure if it's really needed, as it apparently has worked this way for 
some time, but I've commited a change to make it the way it was before the 
commit, thanks.

> but
>
> 1) Before this line, there was also :
> ::vos::IMutex& rMutex = Application::GetSolarMutex();
>
> if ( rMutex.tryToAcquire() )
>
> I don't know if these are still useful
>
> 2) in the function doShutdown, there's only on line 1947 :
> sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
>
> So i don't know too if -1 is necessary or not

 The solar mutex is a recursive mutex (can be acquire several times by the 
same thread), the tryToAcquire() call I'd guess is a test if the current 
thread has it acquired, but it seems to be pointless, as ReleaseSolarMutex() 
would just return 0 otherwise. The -1 is to compensate for this one 
additional acquire. Just confused and pointless, as far as I can say.

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list