https://bugs.documentfoundation.org/show_bug.cgi?id=154105
Bug ID: 154105
Summary: XCloseBroadcaster: Calc document instance calls
XCloseListener::queryClosing AFTER closing the
document
Product: LibreOffice
Version: 7.4.5.1 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: [email protected]
Reporter: [email protected]
I'm developing a Calc Add-On (using C++ UNO-API), wich has multiple threads
modifying several sheets of an open Calc document.
So, to give a clean exit upon user's closing requests, a component is
registered as XCloseListener of the document (the XCloseBroadcaster). The idea
is to veto the close request while any of the Add-On running threads are
"bussy" (i.e., producing changes in one or more sheet/s), otherwise, dead-lock
conditions are reached (main thread of soffice.bin locks an internal mutex that
blocks one or more threads of the Add-On).
Digging, I've found that the XCloseBroadcaster queryes the close (i.e., it
calls XCloseListener::queryClosing) AFTER it's closed, so any
CloseVetoException thrown by the listener has no effect.
Indeed, the component implementing the XCloseListener interface, also
implements XDocumentEventListener interfece.
XDocumentEventListener::XDocumentEventOccured implementation just prints out in
console the event occured.
As said before, XCloseListener::queryClosing throws CloseVetoException if at
least one of Add-On's threads isn't "iddle". In that case, it also prints out a
meesage warning that the close query is vetoed.
Looking at the output, the proble is clear:
[SheetUtilityImpl::documentEventOccured] OnPrepareViewClosing
[SheetUtilityImpl::documentEventOccured] OnPrepareUnload
[SheetUtilityImpl::documentEventOccured] OnModeChanged
[SheetUtilityImpl::documentEventOccured] OnModeChanged
[SheetUtilityImpl::documentEventOccured] OnViewClosed
[SheetUtilityImpl::documentEventOccured] OnUnload
[SheetUtilityImpl::documentEventOccured] OnUnfocus
[SheetUtilityImpl::queryClosing] Vetoing closing (executor/s is/are still
running...)
As can be seen, SheetUtilityImpl::queryClosing is called AFTER the OnUnload
event (i.e., after the document has been effectively closed). So, the veto
thrown is ignored.
I have tested it only on linux. Soon I'll test it on Windows.
Is there a cahnce to fix it on next release 7.5.x?
--
You are receiving this mail because:
You are the assignee for the bug.