[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Mon Jan 27 06:28:46 PST 2014
sc/inc/mtvelements.hxx | 2 +-
sc/source/core/data/column2.cxx | 19 ++++++++-----------
2 files changed, 9 insertions(+), 12 deletions(-)
New commits:
commit b5f9c2be36f935f0009c2d7c40f7fadebf0b7ef8
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Jan 24 21:29:54 2014 -0500
Stop leaking all ScPostIt instances.
And re-implement correct swapping of two ScPostIt instances during
sort.
(cherry picked from commit ab05317c79f665bcf9d5cff7b8312ce6963ff969)
Change-Id: Ifbf120aae594342ae0b7c5760f771c53092c8022
Reviewed-on: https://gerrit.libreoffice.org/7641
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 0fcafde..3eb5527 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -65,7 +65,7 @@ const mdds::mtv::element_t element_type_empty = mdds::mtv::element_type_empty;
/// Custom element blocks.
-typedef mdds::mtv::default_element_block<element_type_cellnote, ScPostIt*> cellnote_block;
+typedef mdds::mtv::noncopyable_managed_element_block<element_type_cellnote, ScPostIt> cellnote_block;
typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> broadcaster_block;
typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> celltextattr_block;
typedef mdds::mtv::default_element_block<element_type_string, svl::SharedString> string_block;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ad16dd4..20d3ee7 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1902,8 +1902,6 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
if (aPos2.first == maCellNotes.end())
return;
- ScPostIt* aNote;
-
sc::CellNoteStoreType::iterator it1 = aPos1.first, it2 = aPos2.first;
if (it1->type == it2->type)
{
@@ -1917,10 +1915,10 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
sc::cellnote_block::at(*it2->data, aPos2.second));
//update Note caption with position
- aNote = sc::cellnote_block::at(*it1->data, aPos1.second);
- aNote->UpdateCaptionPos(ScAddress(nCol,nRow2,nTab));
- aNote = sc::cellnote_block::at(*it2->data, aPos2.second);
- aNote->UpdateCaptionPos(ScAddress(nCol,nRow1,nTab));
+ ScPostIt* pNote = sc::cellnote_block::at(*it1->data, aPos1.second);
+ pNote->UpdateCaptionPos(ScAddress(nCol,nRow2,nTab));
+ pNote = sc::cellnote_block::at(*it2->data, aPos2.second);
+ pNote->UpdateCaptionPos(ScAddress(nCol,nRow1,nTab));
return;
}
@@ -1931,19 +1929,18 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
// row 1 is empty while row 2 is non-empty.
ScPostIt* pVal2 = sc::cellnote_block::at(*it2->data, aPos2.second);
it1 = maCellNotes.set(it1, nRow1, pVal2);
- maCellNotes.set_empty(it1, nRow2, nRow2);
+ maCellNotes.release(it1, nRow2, pVal2);
pVal2->UpdateCaptionPos(ScAddress(nCol,nRow1,nTab)); //update Note caption with position
return;
}
// row 1 is non-empty while row 2 is empty.
- ScPostIt* pVal1 = sc::cellnote_block::at(*it1->data, aPos1.second);
- it1 = maCellNotes.set_empty(it1, nRow1, nRow1);
+ ScPostIt* pVal1 = NULL;
+ it1 = maCellNotes.release(it1, nRow1, pVal1);
+ assert(pVal1);
maCellNotes.set(it1, nRow2, pVal1);
pVal1->UpdateCaptionPos(ScAddress(nCol,nRow1,nTab)); //update Note caption with position
-
- CellStorageModified();
}
SvtBroadcaster* ScColumn::GetBroadcaster(SCROW nRow)
More information about the Libreoffice-commits
mailing list