Kaydet (Commit) 6c92e54a authored tarafından Michael Stahl's avatar Michael Stahl

sw: work around buggy boost::intrusive::circular_list_algorithms::unlink()

Boost is clearly following the C++ tradition of surprising omissions.

Change-Id: I205ef17f87b176da938ebfa3e1a0748e94605daf
üst 54e93460
......@@ -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)
{
......
......@@ -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()
......
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