Solarmutex Deadlock when Closing Calc which contains functions with XVolatileResult return values

Stephan Bergmann sbergman at
Fri Aug 10 07:18:30 PDT 2012

On 08/10/2012 03:35 PM, anwen wrote:
> Stephan Bergmann-2 wrote
>> I think you should execute your shutdown activies on notifyTermination,
>> not queryTermination.  The latter can be veto'ed by some other listener,
>> in which case Desktop would cancel the termination and continue running
>> (and notify you with queryTermination eventually followed by
>> notifyTermination again later on).
> Thank you for your suggestion. Yes, queryTermination should be a place to
> set up some status changes. And real stop or shutdown a process should be
> done in notifyTermination. BTW, I saw that there is a XTerminationListener2
> where cancelTermination() is called when the master environment (e.g.,
> desktop) was canceled in it's terminate request. Is it good to use this
> interface?

As long as you only listen on notifyTermination, you don't need to 
support the derived XTerminationListener2.

>> That queryTermination is called with SolarMutex locked is a bug.  (Is
>> notifyTermination also called with SolarMutex locked?  Would need to
>> check, in framework/source/services/desktop.cxx.)  However, it might be
>> a bug not easy to fix without opening any number of pandora's boxes...
> Is there a bug report number regarding this issue? I would like to check its
> progress in the future. In addition, since notifyTermination is also
> protected by SolarMutex, I am wondering if you see any workaround to deal
> with such a deadlock issue related to multithread shutdown.  Thank you.

I'm not aware of any specific bug for this.  I see no workaround short 
of a proper fix.  And a proper fix would mean to (a) identify the place 
up the call stack from Desktop::terminate where SolarMutex is locked (I 
assume that TransactionGuard is not SolarMutex, but yet another locking 
for Desktop's private parts, but I may be wrong), (b) redesign that code 
path so that Desktop::terminate can call notifyTermination without 
SolarMutex, (c) see if any of the existing listeners on 
notifyTermination exploited the fact that they used to be called with 
SolarMutex locked and need to be adapted now.


More information about the LibreOffice mailing list