diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-02-13 15:06:16 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-16 22:26:44 +0100 |
commit | 54e93460a53629c9428d3ed129a32f052b6bdd7e (patch) | |
tree | f6269d12beeddbf6f3642b0bd406f1b18b0218e7 /sw | |
parent | b6e43aac665d700d3474bb757afd7be492f65d2a (diff) |
(related: tdf#80715) sw: fix Ring::MoveTo() not doing anything...
... if the parameter is currently in the same list.
The "boost::intrusive::circular_list_algorithms::transfer" has a
precondition that the 2 parameters must not be in the same list.
This causes an infinite loop in SwFindParaText::Find(), which is hiding
the infinite loop that i'm trying to debug...
While at it, remove some unnecessary complexity.
Change-Id: Ib41f52c6d5c44ecc358c6170ee1e6e98729e1302
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ring.hxx | 10 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index e0bfc5a30b90..9f70061e9725 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -135,16 +135,12 @@ namespace sw inline void Ring<value_type>::MoveTo(value_type* pDestRing) { value_type* pThis = static_cast< value_type* >(this); + algo::unlink(pThis); // insert into "new" - if( pDestRing ) + if (pDestRing) { - if(algo::unique(pThis)) - algo::link_before(pDestRing, pThis); - else - algo::transfer(pDestRing, pThis); + algo::link_before(pDestRing, pThis); } - else - algo::unlink(pThis); } /** diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 96d2a34089ed..0c0635588e0c 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1372,6 +1372,15 @@ void SwDocTest::testIntrusiveRing() const TestRing* pRing = &r; CPPUNIT_ASSERT(pRing); } + TestRing foo, bar; + foo.MoveTo(&bar); + CPPUNIT_ASSERT_EQUAL(&foo, bar.GetNext()); + CPPUNIT_ASSERT_EQUAL(&foo, bar.GetPrev()); + CPPUNIT_ASSERT_EQUAL(&bar, foo.GetNext()); + CPPUNIT_ASSERT_EQUAL(&bar, foo.GetPrev()); + foo.MoveTo(&foo); + CPPUNIT_ASSERT_EQUAL(&bar, bar.GetNext()); + CPPUNIT_ASSERT_EQUAL(&bar, bar.GetPrev()); } void SwDocTest::setUp() |