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:07:16 +0100 |
commit | f73e4594d363c67042089f79f056fc8dae7cf61e (patch) | |
tree | 06e89a421305489ec400d90940aa71ee49f7b9bc /desktop | |
parent | 2ddcc1afb07e75ef388a200faeeacf833520a0d9 (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); } |