diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-02-13 15:57:32 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-16 22:26:45 +0100 |
commit | 6c92e54a3abcaa1d8f5d83d74dfb0b77415be1d3 (patch) | |
tree | cbe8ecabb5729d214683dea9df8f1c09af47f8d0 /sw | |
parent | 54e93460a53629c9428d3ed129a32f052b6bdd7e (diff) |
sw: work around buggy boost::intrusive::circular_list_algorithms::unlink()
Boost is clearly following the C++ tradition of surprising omissions.
Change-Id: I205ef17f87b176da938ebfa3e1a0748e94605daf
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ring.hxx | 11 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index 9f70061e9725..f6aac23eda4a 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -43,7 +43,14 @@ namespace sw typedef RingContainer<value_type> ring_container; typedef RingContainer<const_value_type> const_ring_container; virtual ~Ring() - { algo::unlink(this); }; + { unlink(); }; + /** algo::unlink is buggy! don't call it directly! */ + void unlink() + { + algo::unlink(this); + pNext = this; // don't leave pointers to old list behind! + pPrev = this; + } /** * Removes this item from its current ring container and adds it to * another ring container. If the item was not alone in the original @@ -135,7 +142,7 @@ namespace sw inline void Ring<value_type>::MoveTo(value_type* pDestRing) { value_type* pThis = static_cast< value_type* >(this); - algo::unlink(pThis); + unlink(); // insert into "new" if (pDestRing) { diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 0c0635588e0c..dcd002338a91 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1381,6 +1381,8 @@ void SwDocTest::testIntrusiveRing() foo.MoveTo(&foo); CPPUNIT_ASSERT_EQUAL(&bar, bar.GetNext()); CPPUNIT_ASSERT_EQUAL(&bar, bar.GetPrev()); + CPPUNIT_ASSERT_EQUAL(&foo, foo.GetNext()); + CPPUNIT_ASSERT_EQUAL(&foo, foo.GetPrev()); } void SwDocTest::setUp() |