diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-17 19:57:25 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-06-18 12:05:41 +0100 |
commit | a66b897ba4eed3e4d75aae785115bdc2bf051207 (patch) | |
tree | 08f17f456537d4a682e1b83c5c059caed5ffd396 /desktop | |
parent | e9ef07ed691399119b6bc5f1d2d79222667766c6 (diff) |
LOK: kill double initialize.
Change-Id: I4d3dd913faea8b9f4a0bd3c13af37d097ced9888
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6c05f815f008..eed7831eaf54 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -41,6 +41,7 @@ #include <vcl/graphicfilter.hxx> #include <unotools/syslocaleoptions.hxx> #include <unotools/mediadescriptor.hxx> +#include <osl/module.hxx> using namespace css; using namespace utl; @@ -207,7 +208,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass); m_pOfficeClass->destroy = lo_destroy; - m_pOfficeClass->initialize = lo_initialize; m_pOfficeClass->documentLoad = lo_documentLoad; m_pOfficeClass->getError = lo_getError; @@ -411,7 +411,17 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) if (!pAppPath) return 0; - OUString aAppPath(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8); + OUString aAppPath; + if (pAppPath) + { + aAppPath = OUString(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8); + } + else + { + ::osl::Module::getUrlFromAddress( reinterpret_cast< oslGenericFunction >(lo_initialize), + aAppPath); + } + OUString aAppURL; if (osl::FileBase::getFileURLFromSystemPath(aAppPath, aAppURL) != osl::FileBase::E_None) return 0; @@ -440,12 +450,16 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) return bInitialized; } -SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(void) +SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(const char* install_path) { if (!gImpl) { fprintf(stderr, "create libreoffice object\n"); gImpl = new LibLibreOffice_Impl(); + if (!lo_initialize(gImpl, install_path)) + { + lo_destroy(gImpl); + } } return static_cast<LibreOfficeKit*>(gImpl); } |