diff options
-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() |