diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-02-13 14:36:02 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-16 22:26:39 +0100 |
commit | b6e43aac665d700d3474bb757afd7be492f65d2a (patch) | |
tree | bfe45349bcebbb8e032369b2404a4a7e456075bf /sw | |
parent | f7db2461292be3e23f5b3af47e488eaa8105d8db (diff) |
sw: RingContainer::merge(): assert that the Rings aren't already linked
The function would un-merge them in that case, which is just a little
bit surprising.
Change-Id: Ife1d572635b812d3ff5b9f93c1ddf1954e12aca5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ring.hxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index 8083e959f0e9..e0bfc5a30b90 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -185,6 +185,10 @@ namespace sw */ void merge( RingContainer< value_type > aDestRing ) { + // first check that we aren't merged already, swapping would + // actually un-merge in this case! + assert(m_pStart->pPrev != aDestRing.m_pStart); + assert(m_pStart != aDestRing.m_pStart->pPrev); std::swap(*(&m_pStart->pPrev->pNext), *(&aDestRing.m_pStart->pPrev->pNext)); std::swap(*(&m_pStart->pPrev), *(&aDestRing.m_pStart->pPrev)); } |