[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - desktop/source

Jan Holesovsky kendy at collabora.com
Tue Oct 3 09:20:22 UTC 2017


 desktop/source/lib/init.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit b8ad0fc55baa69724e90dc3bb7d96fbd7149b163
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Oct 3 10:48:26 2017 +0200

    lok: Fix declaration of ‘xContext’ shadows a global declaration.
    
    Change-Id: Iab3c142cd85ca54bf3c37a0710ce7da7a5d77a35
    Reviewed-on: https://gerrit.libreoffice.org/43067
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 65d5b43ce14b..3bbb7b98043d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2364,11 +2364,20 @@ static void doc_resetSelection(LibreOfficeKitDocument* pThis)
 
 static char* getLanguages(const char* pCommand)
 {
-    css::uno::Reference< css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
-    css::uno::Reference< css::linguistic2::XLinguServiceManager2 > xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
-    css::uno::Reference< css::linguistic2::XSpellChecker > xSpell(xLangSrv.is() ? xLangSrv->getSpellChecker() : nullptr, css::uno::UNO_QUERY);
-    css::uno::Reference< css::linguistic2::XSupportedLocales > xLocales(xSpell, css::uno::UNO_QUERY);
-    css::uno::Sequence< css::lang::Locale > aLocales(xLocales.is() ? xLocales->getLocales() : css::uno::Sequence< css::lang::Locale >());
+    css::uno::Sequence< css::lang::Locale > aLocales;
+
+    if (xContext.is())
+    {
+        css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
+        if (xLangSrv.is())
+        {
+            css::uno::Reference<css::linguistic2::XSpellChecker> xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY);
+            css::uno::Reference<css::linguistic2::XSupportedLocales> xLocales(xSpell, css::uno::UNO_QUERY);
+
+            if (xLocales.is())
+                aLocales = xLocales->getLocales();
+        }
+    }
 
     boost::property_tree::ptree aTree;
     aTree.put("commandName", pCommand);


More information about the Libreoffice-commits mailing list