Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 08/08/2012 08:34 PM, anwen wrote:
With the TerminateListener, I successfully get the desktop termination event
by queryTermination() function. Although you told me that I could veto this
termination signal by throwing TerminationVetoException. I am not sure how
and where to handle the TerminationVetoException and re-call
XDesktop.terminate() to finally close the office. So I tried to handle
everything inside queryTermination().

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).

However, deadlock happened sometimes again. Here is my analysis: this
function is called by the main thread and is protected by the SolarMutex. If
a modified() function is called by the worker thread at the same time, the
worker thread is waiting for the SolarMutex. Then the main thread tries to
stop the worker thread by calling realtime_session->stop(). This session is
designed with thread safe strategy by a third-party. It fails to close the
worker thread because the worker thread is waiting for the Main thread to
release the SolarMutex.

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...

Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.