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
This commit is contained in:
Matúš Kukan 2014-01-08 22:02:08 +01:00
parent 3cb4aa944a
commit eb89c6f7dc

View file

@ -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();
}