summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-01-19 11:30:12 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-01-19 11:30:12 +0100
commit4a5dda084a8257bde6d89f7657a54def9e286c21 (patch)
tree7a1b04a300ae9650d3aeeed9f21ab9eff7ea3917
parent8d1a24dae03690b576310e3539369916f31ac475 (diff)
Make sure desktop under LOK does not see osl_setCommandArgs CommandLineArgs
Our sal/cppunittester/cppunittester.cxx uses SAL_IMPLEMENT_MAIN, so forwards the cmd line args to osl_setCommandArgs. CppunitTest_libreofficekit_tiledrendering (run via that cppunittester) starts LOK, which starts SVMain on a lo_startmain thread, which calls deskopt::DispatchWatcher::executeDispatchRequests to process any cmd line arg requests to open documents. It sees the libtest_libreofficekit_tiledrendering.so (or .dylib/.dll) passed to cppunittester, and tries to open it as a LO document. Type detection will typically determine it is plain text that should be opened with Writer, which will succeed. But when the .so is built with GCC 6, it happens to be detected as a MacPaint document, loading which fails, so that executeDispatchRequests (desktop/source/app/dispatchwatcher.cxx) will call xDesktop->terminate(), which unwinds that lo_startmain thread (DeInitVCL etc.). But the main cppunittester thread is still calling into LOK, which is under the assumption that VCL etc. is still functional, and somewhat random crashes will happen. Change-Id: Ie7b00e797a0f3223b3942bb63a31aa9c44370247
-rw-r--r--desktop/source/app/cmdlineargs.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index aa652341101d..b2b1ba8ce0d1 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -30,6 +30,7 @@
#include <rtl/uri.hxx>
#include <rtl/ustring.hxx>
#include <rtl/process.h>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
#include <tools/getprocessworkingdir.hxx>
@@ -70,7 +71,9 @@ std::vector< OUString > translateExternalUris(
class ExtCommandLineSupplier: public CommandLineArgs::Supplier {
public:
explicit ExtCommandLineSupplier():
- m_count(rtl_getAppCommandArgCount()),
+ m_count(
+ comphelper::LibreOfficeKit::isActive()
+ ? 0 : rtl_getAppCommandArgCount()),
m_index(0)
{
OUString url;