[Libreoffice-commits] core.git: svtools/source

Matúš Kukan matus.kukan at collabora.com
Wed Jan 8 13:14:42 PST 2014


 svtools/source/uno/fpicker.cxx |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit eb89c6f7dcd613cda6a9eee6f7897225e0334a25
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Wed Jan 8 22:02:08 2014 +0100

    Do not initialize FilePicker with empty argument.
    
    This is tricky.
    In constructor, we don't know if we were called by service manager's
    createInstanceWithArgumentsAndContext or just createInstanceWithContext,
    so we don't know if initialize should be called.
    Let's assume that nobody would use createInstanceWithArgumentsAndContext
    with empty argument. Then the behaviour should be the same as before.
    
    FolderPicker does not seem to be called with arguments.
    
    Change-Id: If33dc20fe1b2b10b092ff35fa0b258137c8e94b2

diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx
index 7a4b769..9ff1f6d 100644
--- a/svtools/source/uno/fpicker.cxx
+++ b/svtools/source/uno/fpicker.cxx
@@ -94,7 +94,7 @@ com_sun_star_comp_svt_FilePicker_get_implementation(
         svt::addFilePicker (xResult);
     }
     css::uno::Reference< css::lang::XInitialization > xx(xResult, css::uno::UNO_QUERY);
-    if (xx.is())
+    if (xx.is() && arguments->nElements)
     {
         css::uno::Sequence<css::uno::Any> aArgs(
                 reinterpret_cast<css::uno::Any *>(arguments->elements),
@@ -126,7 +126,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
 com_sun_star_comp_svt_FolderPicker_get_implementation(
         css::uno::XComponentContext *context, uno_Sequence * arguments)
 {
-    assert(arguments != 0);
+    assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
     Reference< css::uno::XInterface > xResult;
     Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager());
     if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
@@ -158,14 +158,6 @@ com_sun_star_comp_svt_FolderPicker_get_implementation(
         // Add to FolderPicker history.
         svt::addFolderPicker (xResult);
     }
-    css::uno::Reference< css::lang::XInitialization > xx(xResult, css::uno::UNO_QUERY);
-    if (xx.is())
-    {
-        css::uno::Sequence<css::uno::Any> aArgs(
-                reinterpret_cast<css::uno::Any *>(arguments->elements),
-                arguments->nElements);
-        xx->initialize(aArgs);
-    }
     xResult->acquire();
     return xResult.get();
 }


More information about the Libreoffice-commits mailing list