Bug 151945 - XDesktop::Terminate() stops all the instances of soffice
Summary: XDesktop::Terminate() stops all the instances of soffice
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
7.3.6.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-07 10:56 UTC by gerard
Modified: 2022-11-07 12:20 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gerard 2022-11-07 10:56:28 UTC
Hi,

Description:
I start manually LibreOffice Writer to edit a document.
Then, I run a java application. It starts soffice calling the method BootstrapSocketConnector.connect().
The requests to soffice are well processed (odt to pdf exports).
When I stop the java application, it calls xDesktop.terminate().

Actual result:
xDesktop.terminate() stops all the instances of soffice including the one I started manually.

Expected result:
The only soffice instance to be stopped should be the one started by the java application.

Reproducible: Always

Is it an issue? How can I fix it in my java code in order to stop only the instance started by the java application ?

Thanks,
Gerard
Comment 1 Mike Kaganski 2022-11-07 11:35:19 UTC
This is not a bug.

LibreOffice is designed to only run one instance of the application using a given user profile. So if you do not specify to use a separate profile when you call it from your application, it uses the existing running process. Calling terminate() then naturally terminates that single process.

In order to have separate processes, use a separate user profile. That may be done using -env command line parameter when starting soffice [1].

Being unfamiliar with Java, and not seeing the specific code you use, I can't advise how to improve the code to specify the user profile there. However, I assume that question is a kind of "how do I", and is more suitable for https://ask.libreoffice.org/.

[1] https://help.libreoffice.org/latest/en-US/text/shared/guide/start_parameters.html?DbPAR=SHARED
Comment 2 gerard 2022-11-07 12:20:22 UTC
I get the expected result now. Thank you for your help!