[Libreoffice-commits] .: Branch 'libreoffice-3-5-1' - xmloff/source
Eike Rathke
erack at kemper.freedesktop.org
Mon Mar 5 04:13:23 PST 2012
xmloff/source/chart/SchXMLTableContext.cxx | 10 +++++-----
xmloff/source/chart/transporttypes.hxx | 12 ++++--------
2 files changed, 9 insertions(+), 13 deletions(-)
New commits:
commit 7f1f734113cc443caa2be4fbe376ab85d09eefac
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Mar 3 00:56:04 2012 +0100
don't create uno::Sequence with new, fdo#46825
The uno::Sequence copy c'tor creates a flat copy and increments the ref
count. So if you use new and later delete together with the copy
constructor you get a double delete.
Signed-off-by: Kohei Yoshida <kohei.yoshida at suse.com>
(cherry picked from commit 61600b62068bf7837c532c8b32377984ee76af1e)
Signed-off-by: Eike Rathke <erack at redhat.com>
Signed-off-by: Michael Meeks <michael.meeks at suse.com>
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 55c0368..f1f8af9 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -730,9 +730,9 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext(
if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_LIST ) && mbReadText )
{
SchXMLCell& rCell = mrTable.aData[ mrTable.nRowIndex ][ mrTable.nColumnIndex ];
- rCell.pComplexString = new Sequence< OUString >();
+ rCell.aComplexString = Sequence< OUString >();
rCell.eType = SCH_CELL_TYPE_COMPLEX_STRING;
- pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString );
+ pContext = new SchXMLTextListContext( GetImport(), rLocalName, rCell.aComplexString );
mbReadText = sal_False;//don't apply text from <text:p>
}
// <text:p> element - read text (and range from text:id old version)
@@ -772,12 +772,12 @@ void lcl_ApplyCellToComplexLabel( const SchXMLCell& rCell, Sequence< uno::Any >&
rComplexLabel.realloc(1);
rComplexLabel[0] = uno::makeAny( rCell.aString );
}
- else if( rCell.pComplexString && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING )
+ else if( rCell.aComplexString.getLength() && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING )
{
- sal_Int32 nCount = rCell.pComplexString->getLength();
+ sal_Int32 nCount = rCell.aComplexString.getLength();
rComplexLabel.realloc( nCount );
for( sal_Int32 nN=0; nN<nCount; nN++)
- rComplexLabel[nN] = uno::makeAny((*rCell.pComplexString)[nN]);
+ rComplexLabel[nN] = uno::makeAny((rCell.aComplexString)[nN]);
}
else if( rCell.eType == SCH_CELL_TYPE_FLOAT )
{
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
index ffa4111..cb03cbc 100644
--- a/xmloff/source/chart/transporttypes.hxx
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -45,17 +45,17 @@ enum SchXMLCellType
struct SchXMLCell
{
rtl::OUString aString;
- ::com::sun::star::uno::Sequence< rtl::OUString >* pComplexString;
+ ::com::sun::star::uno::Sequence< rtl::OUString > aComplexString;
double fValue;
SchXMLCellType eType;
rtl::OUString aRangeId;
- SchXMLCell() : pComplexString(0), fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN )
+ SchXMLCell() : aComplexString(), fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN )
{}
SchXMLCell( const SchXMLCell& rOther )
: aString( rOther.aString )
- , pComplexString( rOther.pComplexString ? new ::com::sun::star::uno::Sequence< rtl::OUString >( *rOther.pComplexString ) : 0 )
+ , aComplexString( rOther.aComplexString )
, fValue( rOther.fValue )
, eType( rOther.eType )
, aRangeId( rOther.aRangeId )
@@ -63,11 +63,7 @@ struct SchXMLCell
~SchXMLCell()
{
- if(pComplexString)
- {
- delete pComplexString;
- pComplexString=0;
- }
+
}
};
More information about the Libreoffice-commits
mailing list