tdf#163486: PVS: reference may become invalid
V758 The 'aModel' reference becomes invalid when smart pointer returned by a function is destroyed. Change-Id: If06b81fda6fdaf4debf5061dd0e3c6c7caccad5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176742 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
fd63354d2d
commit
7a1ab3f0a3
1 changed files with 5 additions and 4 deletions
|
@ -303,16 +303,17 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
|
|||
if( !xLabeledSeq.is() && !mrModel.maSeries.empty() ) {
|
||||
if( nMaxValues < 0 )
|
||||
nMaxValues = 2;
|
||||
SeriesModel &aModel = *mrModel.maSeries.get(0);
|
||||
if (!aModel.maSources.has(SeriesModel::CATEGORIES))
|
||||
typedef RefVector<SeriesModel> SeriesModelVector;
|
||||
SeriesModelVector::value_type aModel = mrModel.maSeries.get(0);
|
||||
if (!aModel->maSources.has(SeriesModel::CATEGORIES))
|
||||
{
|
||||
DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES );
|
||||
DataSourceModel &aSrc = aModel->maSources.create( SeriesModel::CATEGORIES );
|
||||
DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
|
||||
aSeq.mnPointCount = nMaxValues;
|
||||
for( sal_Int32 i = 0; i < nMaxValues; i++ )
|
||||
aSeq.maData[ i ] <<= OUString::number( i + 1 );
|
||||
}
|
||||
SeriesConverter aSeriesConv( *this, aModel );
|
||||
SeriesConverter aSeriesConv( *this, *aModel );
|
||||
xLabeledSeq = aSeriesConv.createCategorySequence( u"categories"_ustr );
|
||||
}
|
||||
return xLabeledSeq;
|
||||
|
|
Loading…
Reference in a new issue