Kaydet (Commit) 4a5dda08 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 8d1a24da
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment