lingucomponent/source/thesaurus/libnth/nthesimp.cxx |    5 ++++-
 linguistic/source/lngsvcmgr.cxx                     |    3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit fed392061613f71ecd04a485a8ec0de0595b441c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jul 20 12:49:02 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 20 17:28:33 2020 +0200

    fix SAL_WARN when instantiating Thesaurus
    
    Before
        commit 3fbadfa1ad41a3477804c592e06caec708c05218
        lingucomponent: create instances with uno constructors
    Thesaurus was constructed but Thesaurus::initialize was NOT being called
    from GetAvailLocales.
    
    However, we have some code marked "HACK" in
       cppuhelper/source/servicemanager.cxx
    i.e.
       ServiceManager....::createInstanceWithArguments
    which DOES call initialize.
    
    And we have code in GetAvailLocales which passes what Thesuarus
    considers an invalid number of arguments, because all the other similar
    services DO take 2 args (even though they don't use the second arg!)
    
    So we have a bunch of temporary hack and backwards compat stuff
    interacting, causing a SAL_WARN.
    
    So make Thesauras::initialize a little more tolerant, which means we're
    now initialising it, which is a change in behaviour, so if this commit
    comes up a regression, we will need find another warn to stop the
    warning.
    
    Change-Id: I60e0ed1bd2d4fbccbc539b5536aba055a7dfc6c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99039
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 11f557cd1d54..a8b32bd4727f 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -466,10 +466,13 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any 
>& rArguments )
         return;
 
     sal_Int32 nLen = rArguments.getLength();
-    if (1 == nLen)
+    // Accept one of two args so we can be compatible with the call site in 
GetAvailLocales()
+    // linguistic module
+    if (1 == nLen || 2 == nLen)
     {
         Reference< XLinguProperties >   xPropSet;
         rArguments.getConstArray()[0] >>= xPropSet;
+        assert(xPropSet);
 
         //! Pointer allows for access of the non-UNO functions.
         //! And the reference to the UNO-functions while increasing
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5c741fdd05e2..5891dbbd4fb1 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -73,8 +73,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
     {
         std::set< LanguageType > aLanguages;
 
-        //! since we're going to create one-instance services we have to
-        //! supply their arguments even if we would not need them here...
+        // All of these services only use one arg, but need two args for 
compat reasons
         uno::Sequence< uno::Any > aArgs(2);
         aArgs.getArray()[0] <<= GetLinguProperties();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to