[Libreoffice-commits] core.git: desktop/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 19 02:41:41 PST 2016


 desktop/source/app/cmdlineargs.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4a5dda084a8257bde6d89f7657a54def9e286c21
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 19 11:30:12 2016 +0100

    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

diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
index aa65234..b2b1ba8 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;


More information about the Libreoffice-commits mailing list