[PATCH] [REVIEW:3-5,3-5-5] fdo#51619 crash regression in 3.5.5 wrt to 3.5.4

Lionel Elie Mamane lionel at mamane.lu
Mon Jul 2 07:13:10 PDT 2012


On Mon, Jul 02, 2012 at 03:33:21PM +0200, Lionel Elie Mamane wrote:
> diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
> index 755fe9e..9286efd 100644
> --- a/connectivity/source/commontools/dbtools.cxx
> +++ b/connectivity/source/commontools/dbtools.cxx
> @@ -1819,7 +1819,7 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
>      Reference<XIndexAccess>  xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
>      sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
>      ::std::vector<bool, std::allocator<bool> > aNewParameterSet( _aParametersSet );
> -    if ( nParamCount || ::std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != nParamCount )
> +    if ( nParamCount && ::std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != nParamCount )
>      {
>          static const ::rtl::OUString PROPERTY_NAME(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME));
>          aNewParameterSet.resize(nParamCount ,false);

The idea of this hunk is as follows:

As I understand this code, _aParametersSet / aNewParameterSet stores
at position N the information whether parameter number N has already
been set (and thus does not need to be queried from the user
anymore). So the old code does:

if (there is at least one parameter OR
    the number of parameters that have already been set != the total number of parameters)
{
    prompt the user for parameter values
}

My new code does:

if (there is at least one parameter AND
    the number of parameters that have already been set != the total number of parameters
    (i.e. there is at least one parameter that has not been not, since set parameters <= total parameters)
   )
{
    prompt the user for parameter values
}

So, if (as is the situation in the bug's example document) all
parameters have already been given a value, do not fire up a dialog to
ask the user for the values of ... no parameter, which is silly and the code
handling this dialog cannot handle well; it has an OSL_ENSURE to test
for this:

warn:legacy.osl:13341:1:/home/master/src/libreoffice/core/dbaccess/source/ui/dlg/paramdialog.cxx:106: OParameterDialog::OParameterDialog : can't handle empty containers !

-- 
Lionel


More information about the LibreOffice mailing list