--headless broken with --enable-headless

Stephan Bergmann sbergman at redhat.com
Wed Dec 12 06:44:08 PST 2012

On 12/12/2012 01:12 PM, Stephan Bergmann wrote:
> Now, the interesting thing is that the Linux-specific CreateSalInstance
> (called from ImplSVMain -> InitVCL before calling the application's Main
> in ImplSVMain) explicitly locks the solar mutex thanks to
> <http://cgit.freedesktop.org/libreoffice/core/commit/?id=852574f46f686a936a1b267e5780ca17d0f0d5ab>
> "INTEGRATION: CWS ause0c2 (1.3.18); FILE MERGED: 2004/03/12 15:25:43 hjs
> #115868# anti freeze," while all the other variants of
> CreateSalInstance apparently do not (incl. the one in
> vcl/headless/headlessinst.cxx that is relevant when configured
> --enable-headless, as is the case for this mail thread).  That means
> that all of desktop::Desktop::Main -> Application::Execute ->
> Application::Yield runs with the solar mutex locked on Linux (sans
> --enable-headless configuration) and with the solar mutex unlocked
> everywhere else.
> The commit message for 852574f46f686a936a1b267e5780ca17d0f0d5ab is
> unfortunately rather unhelpful, but temporarily reverting it and doing
> "make check" on a Linux box starts to produce crashes within
> desktop::Desktop::Main -> Application::Execute -> Application::Yield ->
> ..., in code that apparently expects the solar mutex to be locked.

Now, on yet closer inspection, it is only the versions of 
CreateSalInstance for Android and --enable-headless 
(vcl/android/androidinst.cxx, vcl/headless/headlessinst.cxx, both based 
on SvpSalInstance) that do not lock the solar mutex -- while curiously 
enough both release it in DestroySalInstance.  And trying an 
--enable-headless "make check" build soon runs into tests failing with 
soffice.bin instances crashing within desktop::Desktop::Main -> 
Application::Execute -> Application::Yield, in code that apparently 
expects the solar mutex to be locked.

"Consistently acquire solar mutex in all CreateSalInstance variants" 
appears to be what was missing.


More information about the LibreOffice mailing list