diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-28 16:18:57 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-04 12:23:02 +0100 |
commit | 9d7e08bcb9a578651d5d93d7af7ebcab2c75ed27 (patch) | |
tree | 00e1671a7bcd7274c862d8a35b807c44764473cb | |
parent | 541a7ad29b53e406282b45c1b7d84cb06ce06106 (diff) |
LOK: do clean main thread shutdown cleanly.
Change-Id: If44971f67a489f6b50dee6c1683707c47e695de4
-rw-r--r-- | desktop/source/lib/init.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index da488eed3f66..598bfdc3e2cf 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -248,6 +248,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit { OUString maLastExceptionMsg; shared_ptr< LibreOfficeKitClass > m_pOfficeClass; + pthread_t maThread; LibLibreOffice_Impl() { @@ -651,7 +652,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) @@ -719,8 +720,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 @@ -764,8 +764,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; } } |