Kaydet (Commit) c6902761 authored tarafından Noel Grandin's avatar Noel Grandin

Revert "use std::vector in BigPtrArray"

which is causing crashes in the crashtesting in
ooo119635-3.docx and ooo119568-2.docx

It is definitely some kind of use-after-free error, but the
compress and delete logic for BigPtrArray is too hairy for me
to debug right now.

This reverts commit 1eee0abd.

Also revert commit 4f743419
"gdb pretty-printers: fix BigPtrArrayPrinter after recent std::isation"

Change-Id: Id870876432a060f9347aafb43bf0df692ea24464
Reviewed-on: https://gerrit.libreoffice.org/39684Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 23978f85
...@@ -194,10 +194,10 @@ class BigPtrArrayPrinter(object): ...@@ -194,10 +194,10 @@ class BigPtrArrayPrinter(object):
class _iterator(six.Iterator): class _iterator(six.Iterator):
def __init__(self, array): def __init__(self, array):
self.blocks = array['m_vpInf']['_M_impl']['_M_start'] self.blocks = array['m_ppInf']
self.count = array['m_nSize'] self.count = array['m_nSize']
self.pos = 0 self.pos = 0
self.block_count = array['m_vpInf']['_M_impl']['_M_finish'] - array['m_vpInf']['_M_impl']['_M_start'] self.block_count = array['m_nBlock']
self.block_pos = 0 self.block_pos = 0
self.block = None self.block = None
self.indent = "" self.indent = ""
...@@ -246,7 +246,7 @@ class BigPtrArrayPrinter(object): ...@@ -246,7 +246,7 @@ class BigPtrArrayPrinter(object):
raise StopIteration() raise StopIteration()
name = str(self.pos) name = str(self.pos)
node = self.block['mvData']['_M_elems'][self.pos - self.block['nStart']] node = self.block['pData'][self.pos - self.block['nStart']]
value = self._node_value(node) value = self._node_value(node)
if self.pos == self.block['nEnd']: if self.pos == self.block['nEnd']:
self._next_block() self._next_block()
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <tools/solar.h> #include <tools/solar.h>
#include <swdllapi.h> #include <swdllapi.h>
#include <array> #include <array>
#include <vector>
struct BlockInfo; struct BlockInfo;
class BigPtrArray; class BigPtrArray;
...@@ -64,14 +63,16 @@ struct BlockInfo final ...@@ -64,14 +63,16 @@ struct BlockInfo final
class SW_DLLPUBLIC BigPtrArray class SW_DLLPUBLIC BigPtrArray
{ {
protected: protected:
std::vector<BlockInfo*> BlockInfo** m_ppInf; ///< block info
m_vpInf; ///< block info
sal_uLong m_nSize; ///< number of elements sal_uLong m_nSize; ///< number of elements
sal_uInt16 m_nMaxBlock; ///< current max. number of blocks
sal_uInt16 m_nBlock; ///< number of blocks
mutable mutable
sal_uInt16 m_nCur; ///< last used block sal_uInt16 m_nCur; ///< last used block
sal_uInt16 Index2Block( sal_uLong ) const; ///< block search sal_uInt16 Index2Block( sal_uLong ) const; ///< block search
BlockInfo* InsBlock( sal_uInt16 ); ///< insert block BlockInfo* InsBlock( sal_uInt16 ); ///< insert block
void BlockDel( sal_uInt16 ); ///< some blocks were deleted
void UpdIndex( sal_uInt16 ); ///< recalculate indices void UpdIndex( sal_uInt16 ); ///< recalculate indices
// fill all blocks // fill all blocks
......
This diff is collapsed.
...@@ -2184,7 +2184,7 @@ void SwNodes::ForEach( sal_uLong nStart, sal_uLong nEnd, ...@@ -2184,7 +2184,7 @@ void SwNodes::ForEach( sal_uLong nStart, sal_uLong nEnd,
if( nStart < nEnd ) if( nStart < nEnd )
{ {
sal_uInt16 cur = Index2Block( nStart ); sal_uInt16 cur = Index2Block( nStart );
BlockInfo** pp = m_vpInf.data() + cur; BlockInfo** pp = m_ppInf + cur;
BlockInfo* p = *pp; BlockInfo* p = *pp;
sal_uInt16 nElem = sal_uInt16( nStart - p->nStart ); sal_uInt16 nElem = sal_uInt16( nStart - p->nStart );
auto pElem = p->mvData.begin() + nElem; auto pElem = p->mvData.begin() + nElem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment