[Libreoffice-commits] .: 4 commits - sc/source xmloff/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Fri Mar 2 16:03:13 PST 2012
sc/source/ui/namedlg/namedefdlg.cxx | 8 +++++++-
sc/source/ui/view/cellsh1.cxx | 2 --
xmloff/source/chart/SchXMLTableContext.cxx | 12 ++++++------
xmloff/source/chart/transporttypes.hxx | 12 ++++--------
4 files changed, 17 insertions(+), 17 deletions(-)
New commits:
commit 8f2d3c47ad40039a842fa09d98137155dcfdfe9e
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.
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 2228ea6..57841fa 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -729,9 +729,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)
@@ -771,12 +771,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;
- }
+
}
};
commit 5e8628e45c162299f216f6a283cb126744d873ed
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat Mar 3 00:30:43 2012 +0100
make this variable const
there are some lifetime problems related to SchXMLCell and therefore
this helps to limit the scope of possible problems
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 6b2e988..2228ea6 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -124,7 +124,7 @@ void lcl_fillRangeMapping(
const size_t nTableColCount( rRow.size());
for( size_t nCol = 0; nCol < nTableColCount; ++nCol )
{
- OUString aRangeId( rRow[nCol].aRangeId );
+ const OUString aRangeId( rRow[nCol].aRangeId );
if( !aRangeId.isEmpty())
{
if( eDataRowSource == chart::ChartDataRowSource_COLUMNS )
commit 2670516f2d4f385e364cc56855e12b086b1c5a76
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Mar 2 23:54:55 2012 +0100
remove debug statement
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 8f76bf6..ec5b8e8 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -115,7 +115,6 @@
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#include <boost/scoped_ptr.hpp>
-#include <iostream>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
@@ -1743,7 +1742,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case FID_ADD_NAME:
{
- std::cout << "temp" << std::endl;
sal_uInt16 nId = ScNameDefDlgWrapper::GetChildWindowId();
SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
commit 6e93e78c85e0c4eea174483f1d27ee38fd00ee21
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Mar 2 23:48:44 2012 +0100
don't show an error message for empty names in Define Names, fdo#46816
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index a9795d5..282c47a 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -167,7 +167,13 @@ bool ScNameDefDlg::IsNameValid()
}
maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
- if (!ScRangeData::IsNameValid( aName, mpDoc ))
+ if ( aName.isEmpty() )
+ {
+ maBtnAdd.Disable();
+ maFtInfo.SetText(maStrInfoDefault);
+ return false;
+ }
+ else if (!ScRangeData::IsNameValid( aName, mpDoc ))
{
maFtInfo.SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
maFtInfo.SetText(maErrInvalidNameStr);
More information about the Libreoffice-commits
mailing list