sw: work around buggy boost::intrusive::circular_list_algorithms::unlink()
Boost is clearly following the C++ tradition of surprising omissions.
Change-Id: I205ef17f87b176da938ebfa3e1a0748e94605daf
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index 9f70061..f6aac23 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 0c06355..dcd0023 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()