diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-25 21:03:19 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-04 12:23:02 +0100 |
commit | 541a7ad29b53e406282b45c1b7d84cb06ce06106 (patch) | |
tree | cf528fddc5d8eb0b5d9ff04198388843cead3165 /desktop | |
parent | Don't fail on --protector. (diff) | |
download | core-541a7ad29b53e406282b45c1b7d84cb06ce06106.tar.gz core-541a7ad29b53e406282b45c1b7d84cb06ce06106.zip |
Make sure LOK is actually headless.
This prevents e.g. the document recovery dialog from trying to be shown.
Change-Id: I253720f7fa1abd1c053670434f8394473517b670
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index edea4e5fb22e..da488eed3f66 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -677,6 +677,25 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) try { + // We specifically need to make sure we have the "headless" + // command arg set (various code specifically checks via + // CommandLineArgs). We could alternatively add some other + // flag elsewhere to indicate headlessness, which would + // then be set from here or via CommandLineArgs. + // (The first argument is treated specially by osl_setCommandArgs + // however it is valid to make it \0 instead.) + char sName[] = ""; + char sHeadless[] = "--headless"; + char* pArgs[2] = { sName, sHeadless }; + + // If we've set up the command args elsewhere then we cannot do it + // again (as an assert will fire), this will be the case e.g. + // for unit tests (and possibly if UNO is being used in addition + // to LOK in an external program). + if (!osl_areCommandArgsSet()) + { + osl_setCommandArgs(2, pArgs); + } initialize_uno(aAppURL); force_c_locale(); |