summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-28 16:18:57 +0200
committerAndrzej Hunt <andrzej@ahunt.org>2014-08-19 14:06:24 +0200
commit2acb608c195b3fcdefe10b926b2660363d3bc4e8 (patch)
treeda5c2daf01538f95a15fa3f65a619415cfd5f08d
parentd0b2b26c944c89a59a3842b50f300a5c19c5c305 (diff)
LOK: do clean main thread shutdown cleanly.
Change-Id: If44971f67a489f6b50dee6c1683707c47e695de4
-rw-r--r--desktop/source/lib/init.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4d94436e41ca..89c8168b4777 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -253,6 +253,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
{
OUString maLastExceptionMsg;
shared_ptr< LibreOfficeKitClass > m_pOfficeClass;
+ pthread_t maThread;
LibLibreOffice_Impl()
{
@@ -656,7 +657,7 @@ static void* lo_startmain(void*)
static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
{
- (void) pThis;
+ LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
static bool bInitialized = false;
if (bInitialized)
@@ -724,8 +725,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
// then use it to wait until we're definitely ready to continue.
OfficeIPCThread::EnableOfficeIPCThread();
- pthread_t thread;
- pthread_create(&thread, 0, lo_startmain, NULL);
+ pthread_create(&(pLib->maThread), 0, lo_startmain, NULL);
OfficeIPCThread::WaitForReady();
// If the Thread has been disabled again that indicates that a
@@ -769,8 +769,12 @@ SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(const char* install_pat
static void lo_destroy(LibreOfficeKit *pThis)
{
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
- delete pLib;
gImpl = NULL;
+
+ Application::Quit();
+ pthread_join(pLib->maThread, NULL);
+
+ delete pLib;
}
}