summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-03-29 15:59:24 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-03-29 15:59:24 +0200
commit79b0d4ba2cbc5a35adaa9628cc18eb0f46d01f9c (patch)
tree1451c666de726e39537c24a53e0db0a4b195c991 /desktop
parentb87df796ebc8f4d1a5cdfa290a0c6a676d4cc941 (diff)
Don't launch the PipeReaderThread from LOK
ATTENTION: Users of LOK need to ensure somehow that no two processes operate on the same UserInstallation simultanously. Especially the lokdocview widget in gnome-documents is known to be problematic in this regard, cf. the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2016-March/073839.html> "LibreOfficeKit and the UserInstallation". Change-Id: I7bc2edb281c925e479b8006151d8549441c9e9e8
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/officeipcthread.cxx25
-rw-r--r--desktop/source/app/officeipcthread.hxx3
-rw-r--r--desktop/source/lib/init.cxx22
4 files changed, 20 insertions, 32 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 46bb168cdb1c..f99bfde97e77 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -576,7 +576,7 @@ void Desktop::Init()
const CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
// start ipc thread only for non-remote offices
- RequestHandler::Status aStatus = RequestHandler::Enable();
+ RequestHandler::Status aStatus = RequestHandler::Enable(true);
if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR )
{
#if HAVE_FEATURE_MACOSX_SANDBOX
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 922cdaf6b580..0b77b153b849 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -445,14 +445,23 @@ void RequestHandler::RequestsCompleted()
}
}
-RequestHandler::Status RequestHandler::Enable()
+RequestHandler::Status RequestHandler::Enable(bool ipc)
{
::osl::MutexGuard aGuard( GetMutex() );
if( pGlobal.is() )
return IPC_STATUS_OK;
-#if HAVE_FEATURE_DESKTOP
+#if !HAVE_FEATURE_DESKTOP
+ ipc = false;
+#endif
+
+ if (!ipc) {
+ rtl::Reference< RequestHandler > pThread(new RequestHandler);
+ pGlobal = pThread;
+ return IPC_STATUS_OK;
+ }
+
OUString aUserInstallPath;
OUString aDummy;
@@ -588,6 +597,7 @@ RequestHandler::Status RequestHandler::Enable()
pThread->mPipeReaderThread = new PipeReaderThread(*pThread, pipe);
pGlobal = pThread;
pThread->mPipeReaderThread->launch();
+ return IPC_STATUS_OK;
}
else
{
@@ -626,11 +636,6 @@ RequestHandler::Status RequestHandler::Enable()
return IPC_STATUS_2ND_OFFICE;
}
-#else
- rtl::Reference< RequestHandler > pThread(new RequestHandler);
- pGlobal = pThread;
-#endif
- return IPC_STATUS_OK;
}
void RequestHandler::Disable(bool join)
@@ -694,12 +699,6 @@ void RequestHandler::WaitForReady()
}
}
-bool RequestHandler::IsEnabled()
-{
- osl::MutexGuard g(GetMutex());
- return pGlobal.is();
-}
-
void PipeReaderThread::execute()
{
#if HAVE_FEATURE_DESKTOP
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index a21405bd8445..7b154d562e6e 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -115,12 +115,11 @@ class RequestHandler: public salhelper::SimpleReferenceObject
ProcessDocumentsRequest&, bool noTerminate);
// return sal_False if second office
- static Status Enable();
+ static Status Enable(bool ipc);
static void Disable(bool join = true);
// start dispatching events...
static void SetReady();
static void WaitForReady();
- static bool IsEnabled();
bool AreRequestsEnabled() const { return mState == State::RequestsEnabled; }
};
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 46d79d93bbb2..12d0555f66ab 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1920,9 +1920,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
force_c_locale();
}
- // This is horrible crack. I really would want to go back to simply just call
- // InitVCL() here. The RequestHandler thing is just horrible.
-
// We could use InitVCL() here -- and used to before using soffice_main,
// however that now deals with the initialisation for us (and it's not
// possible to try to set up VCL twice.
@@ -1935,28 +1932,21 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// if you try to use loadDocument too early.
// The RequestHandler is specifically set to be ready when all the other
- // init in Desktop::Main (run from soffice_main) is done. We can "enable"
- // the Thread from wherever (it's done again in Desktop::Main), and can
- // then use it to wait until we're definitely ready to continue.
+ // init in Desktop::Main (run from soffice_main) is done. We can enable
+ // the RequestHandler here (without starting any IPC thread;
+ // shortcutting the invocation in Desktop::Main that would start the IPC
+ // thread), and can then use it to wait until we're definitely ready to
+ // continue.
if (eStage != PRE_INIT)
{
SAL_INFO("lok", "Enabling RequestHandler");
- RequestHandler::Enable();
+ RequestHandler::Enable(false);
SAL_INFO("lok", "Starting soffice_main");
pLib->maThread = osl_createThread(lo_startmain, nullptr);
SAL_INFO("lok", "Waiting for RequestHandler");
RequestHandler::WaitForReady();
SAL_INFO("lok", "RequestHandler ready -- continuing");
-
- // If the Thread has been disabled again that indicates that a
- // restart is required (or in any case we don't have a useable
- // process around).
- if (!RequestHandler::IsEnabled())
- {
- fprintf(stderr, "LOK init failed -- restart required\n");
- return false;
- }
}
if (eStage != SECOND_INIT)