summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-08 15:26:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-10 15:28:16 +0200
commita99707d2c4f65a6a5fe160ce2b614aca273f0d2d (patch)
tree48a40d28677bb70a185edf76f76b6d57f9350419 /desktop
parent015578db97bec8926441a9440de6067937f63143 (diff)
Resolves: rhbz#144437 make gnome-documents not crash the whole time
accept that once initted that LibreOffice cannot be deinitted and reinited (without lots of work), but allow the main loop to quit and restart so LOKs thread can run and exit successfully, new LOK connections will restart the main loop. The buckets of global state continues to be valid the whole time this way Change-Id: Ide54c0df2ce4065f7c192ae8c2cedfaaa2b58d72 Reviewed-on: https://gerrit.libreoffice.org/37399 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/officeipcthread.cxx9
-rw-r--r--desktop/source/app/officeipcthread.hxx2
-rw-r--r--desktop/source/lib/init.cxx5
4 files changed, 13 insertions, 5 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c6eafe70bb46..714299e9061b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1996,7 +1996,7 @@ IMPL_LINK_NOARG(Desktop, OpenClients_Impl, void*, void)
// When this server closes down it attempts to recreate the pipe (in RequestHandler::Disable()).
// It's possible that the client has a pending connection request.
// When the IPC thread is not running, this connection locks (because maPipe.accept()) is never called
- RequestHandler::SetReady();
+ RequestHandler::SetReady(true);
OpenClients();
CloseSplashScreen();
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 7e712bc3fdd5..785cfa1d432d 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -932,6 +932,8 @@ void RequestHandler::Disable()
handler->mIpcThread->join();
handler->mIpcThread.clear();
}
+
+ handler->cReady.reset();
}
}
@@ -946,12 +948,15 @@ RequestHandler::~RequestHandler()
assert(!mIpcThread.is());
}
-void RequestHandler::SetReady()
+void RequestHandler::SetReady(bool bIsReady)
{
osl::MutexGuard g(GetMutex());
if (pGlobal.is())
{
- pGlobal->cReady.set();
+ if (bIsReady)
+ pGlobal->cReady.set();
+ else
+ pGlobal->cReady.reset();
}
}
diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx
index d9d70050ded6..7c24f78fcb65 100644
--- a/desktop/source/app/officeipcthread.hxx
+++ b/desktop/source/app/officeipcthread.hxx
@@ -122,7 +122,7 @@ class RequestHandler: public salhelper::SimpleReferenceObject
static Status Enable(bool ipc);
static void Disable();
// start dispatching events...
- static void SetReady();
+ static void SetReady(bool bIsReady);
static void WaitForReady();
bool AreRequestsEnabled() const { return mState == State::RequestsEnabled; }
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 27af7dddca77..4003d4565df5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3063,10 +3063,12 @@ static void lo_startmain(void*)
{
osl_setThreadName("lo_startmain");
- if (GetpApp())
+ if (comphelper::SolarMutex::get())
Application::GetSolarMutex().tryToAcquire();
soffice_main();
+
+ Application::ReleaseSolarMutex();
}
static bool bInitialized = false;
@@ -3233,6 +3235,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
SAL_INFO("lok", "Enabling RequestHandler");
RequestHandler::Enable(false);
SAL_INFO("lok", "Starting soffice_main");
+ RequestHandler::SetReady(false);
pLib->maThread = osl_createThread(lo_startmain, nullptr);
SAL_INFO("lok", "Waiting for RequestHandler");
RequestHandler::WaitForReady();