I’m creating a database, which should be closed completely when last form has been closed. No problem to do this when other documents are open, But when doing this with Base document only it leads to a crash of LO.
Tried this directly in “My Macros and Dialogs”:
SUB TestClose
StarDesktop.Terminate()
' document = ThisComponent.CurrentController.Frame
' dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
' dispatcher.executeDispatch(document, ".uno:Quit", "", 0, Array())
END SUB
You also see the alternative, which is given by the menue. Will quit LO without any problem when executed by menue. Will lead to a crash when executed by a macro.
My system:
Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Note: Sometimes, under Linux, it won’t show any crash. But I couldn’t start LO directly after I have closed the database file. Looked for open process and found LO is still activ for a while, then closed.
Windows-user reported it will crash every time …
See also: Automatisches Schließen einer Datenbankdatei und ggf. des gesamten Desktops