Kaydet (Commit) 58d57d66 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz: InsertWithValidRanges didn't report that it deleted its argument anymore

since...

commit ddd84d08
Date:   Fri Jul 20 17:16:03 2012 +0200

    Convert SV_DECL_PTRARR_SORT_DEL(_SwRedlineTbl) to o3tl::sorted_vector

    Change-Id: Ie7edc6b32b373619d4c0ac154da93650743049cf

otherwise that p = nullptr line at the end doesn't make sense

Change-Id: Ibd5230beb87240cba4b3896dfa2217e25a4db697
Reviewed-on: https://gerrit.libreoffice.org/37760Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst dfe317b4
...@@ -318,6 +318,8 @@ struct CompareSwRedlineTable ...@@ -318,6 +318,8 @@ struct CompareSwRedlineTable
// Notification type for notifying about redlines to LOK clients // Notification type for notifying about redlines to LOK clients
enum class RedlineNotification { Add, Remove, Modify }; enum class RedlineNotification { Add, Remove, Modify };
typedef SwRangeRedline* SwRangeRedlinePtr;
class SwRedlineTable class SwRedlineTable
{ {
public: public:
...@@ -333,9 +335,9 @@ public: ...@@ -333,9 +335,9 @@ public:
bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast<SwRangeRedline* const>(p)) != maVector.end(); } bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast<SwRangeRedline* const>(p)) != maVector.end(); }
size_type GetPos(const SwRangeRedline* p) const; size_type GetPos(const SwRangeRedline* p) const;
bool Insert( SwRangeRedline* p ); bool Insert(SwRangeRedlinePtr& p);
bool Insert( SwRangeRedline* p, size_type& rInsPos ); bool Insert(SwRangeRedlinePtr& p, size_type& rInsPos);
bool InsertWithValidRanges( SwRangeRedline* p, size_type* pInsPos = nullptr ); bool InsertWithValidRanges(SwRangeRedlinePtr& p, size_type* pInsPos = nullptr);
void Remove( size_type nPos ); void Remove( size_type nPos );
bool Remove( const SwRangeRedline* p ); bool Remove( const SwRangeRedline* p );
......
...@@ -1228,9 +1228,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall ...@@ -1228,9 +1228,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall
if( bCallDelete ) if( bCallDelete )
{ {
::comphelper::FlagGuard g(m_isForbidCompressRedlines); ::comphelper::FlagGuard g(m_isForbidCompressRedlines);
//Insert may delete pNewRedl, in which case it sets pNewRedl to nullptr
mpRedlineTable->Insert( pNewRedl ); mpRedlineTable->Insert( pNewRedl );
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl ); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( *pRedl );
if( !mpRedlineTable->Remove( pNewRedl ) ) if (pNewRedl && !mpRedlineTable->Remove(pNewRedl))
{ {
assert(false); // can't happen assert(false); // can't happen
pNewRedl = nullptr; pNewRedl = nullptr;
...@@ -1260,9 +1261,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall ...@@ -1260,9 +1261,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall
// We insert temporarily so that pNew is // We insert temporarily so that pNew is
// also dealt with when moving the indices. // also dealt with when moving the indices.
::comphelper::FlagGuard g(m_isForbidCompressRedlines); ::comphelper::FlagGuard g(m_isForbidCompressRedlines);
//Insert may delete pNewRedl, in which case it sets pNewRedl to nullptr
mpRedlineTable->Insert( pNewRedl ); mpRedlineTable->Insert( pNewRedl );
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam ); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
if( !mpRedlineTable->Remove( pNewRedl ) ) if (pNewRedl && !mpRedlineTable->Remove(pNewRedl))
{ {
assert(false); // can't happen assert(false); // can't happen
pNewRedl = nullptr; pNewRedl = nullptr;
...@@ -1291,9 +1293,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall ...@@ -1291,9 +1293,10 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall
// We insert temporarily so that pNew is // We insert temporarily so that pNew is
// also dealt with when moving the indices. // also dealt with when moving the indices.
::comphelper::FlagGuard g(m_isForbidCompressRedlines); ::comphelper::FlagGuard g(m_isForbidCompressRedlines);
//Insert may delete pNewRedl, in which case it sets pNewRedl to nullptr
mpRedlineTable->Insert( pNewRedl ); mpRedlineTable->Insert( pNewRedl );
m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam ); m_rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
if( !mpRedlineTable->Remove( pNewRedl ) ) if (pNewRedl && !mpRedlineTable->Remove(pNewRedl))
{ {
assert(false); // can't happen assert(false); // can't happen
pNewRedl = nullptr; pNewRedl = nullptr;
......
...@@ -409,7 +409,7 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe ...@@ -409,7 +409,7 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe
} }
} }
bool SwRedlineTable::Insert( SwRangeRedline* p ) bool SwRedlineTable::Insert(SwRangeRedlinePtr& p)
{ {
if( p->HasValidRange() ) if( p->HasValidRange() )
{ {
...@@ -422,7 +422,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p ) ...@@ -422,7 +422,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p )
return InsertWithValidRanges( p ); return InsertWithValidRanges( p );
} }
bool SwRedlineTable::Insert( SwRangeRedline* p, size_type& rP ) bool SwRedlineTable::Insert(SwRangeRedlinePtr& p, size_type& rP)
{ {
if( p->HasValidRange() ) if( p->HasValidRange() )
{ {
...@@ -434,7 +434,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p, size_type& rP ) ...@@ -434,7 +434,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p, size_type& rP )
return InsertWithValidRanges( p, &rP ); return InsertWithValidRanges( p, &rP );
} }
bool SwRedlineTable::InsertWithValidRanges( SwRangeRedline* p, size_type* pInsPos ) bool SwRedlineTable::InsertWithValidRanges(SwRangeRedlinePtr& p, size_type* pInsPos)
{ {
// Create valid "sub-ranges" from the Selection // Create valid "sub-ranges" from the Selection
bool bAnyIns = false; bool bAnyIns = false;
......
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