Hi, On Wed, Jun 10, 2015 at 09:12:32AM +0100, Caolán McNamara wrote: > On Wed, 2015-06-10 at 08:40 +0200, Stephan Bergmann wrote: > > > Assertion failed: (!m_pFirst && !m_pLast && "There are still indices > > > registered"), function ~SwIndexReg, file sw/source/core/bastyp/index.cxx, > > > line 226. > > I imagine that reset on the pCursor before dispose would clear that > assert. But then at that point the test presumably becomes pointless.
I checked with the attached patch against master@a861a234b0f5f39b06fd6180655182c167c3a94d and get: > CPPUNITTRACE="gdb --args" make CppunitTest_sw_uiwriter debug=T > ... > debug:4359:1: DidTestCleanup: Document disposing > debug:4359:1: NodeIndex at 0 > debug:4359:1: Position at 0 > debug:4359:1: UnoCursorPointer is disposed. > ... assuming it to be the same on OSX, pCursor should be innocent -- unless we leak an SwIndex (on OSX only?!?). Best, Bjoern
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 5c8986e..c7b2922 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -44,9 +44,10 @@ $(eval $(call gb_Module_add_targets,sc,\ endif +# $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ +# CppunitTest_sc_ucalc) \ + $(eval $(call gb_Module_add_check_targets,sc,\ - $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ - CppunitTest_sc_ucalc) \ CppunitTest_sc_filters_test \ CppunitTest_sc_rangelst_test \ )) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 1545605..b5b924c 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -96,7 +96,7 @@ public: void testTdf86639(); void testTdf90883TableBoxGetCoordinates(); void testEmbeddedDataSource(); -#if 0 +#if 1 void testUnoCursorPointer(); #endif @@ -137,7 +137,7 @@ public: CPPUNIT_TEST(testTdf86639); CPPUNIT_TEST(testTdf90883TableBoxGetCoordinates); CPPUNIT_TEST(testEmbeddedDataSource); -#if 0 +#if 1 CPPUNIT_TEST(testUnoCursorPointer); #endif CPPUNIT_TEST_SUITE_END(); @@ -1030,7 +1030,9 @@ void SwUiWriterTest::testEmbeddedDataSource() #endif } -#if 0 +#if 1 +#include <functional> +SW_DLLPUBLIC std::function<void(const char*)> g_DidTestCleanup; void SwUiWriterTest::testUnoCursorPointer() { auto xDocComponent(loadFromDesktop( @@ -1043,11 +1045,21 @@ void SwUiWriterTest::testUnoCursorPointer() std::unique_ptr<SwNodeIndex> xIdx(new SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1)); std::unique_ptr<SwPosition> xPos(new SwPosition(*xIdx)); sw::UnoCursorPointer pCursor(pDoc->CreateUnoCrsr(*xPos)); + g_DidTestCleanup = [&xIdx, &xPos, &pCursor] (const char* sCheckpoint) -> void + { + SAL_DEBUG("DidTestCleanup: " << sCheckpoint); + SAL_DEBUG("NodeIndex at " << xIdx.get()); + SAL_DEBUG("Position at " << xPos.get()); + SAL_DEBUG("UnoCursorPointer is "<< (pCursor ? "alive." : "disposed.")); + }; CPPUNIT_ASSERT(static_cast<bool>(pCursor)); + g_DidTestCleanup("Document lives."); xPos.reset(); // we need to kill the SwPosition before disposing xIdx.reset(); // we need to kill the SwNodeIndex before disposing xDocComponent->dispose(); + g_DidTestCleanup("Document disposed."); CPPUNIT_ASSERT(!static_cast<bool>(pCursor)); + g_DidTestCleanup = nullptr; } #endif diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ef6b904..f26d933 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -121,6 +121,9 @@ //UUUU #include <svx/xfillit0.hxx> +#include <functional> +SW_DLLPUBLIC std::function<void(const char*)> g_DidTestCleanup; + using namespace ::com::sun::star; using namespace ::com::sun::star::document; @@ -498,6 +501,8 @@ SwDoc::~SwDoc() // Delete content selections. // Don't wait for the SwNodes dtor to destroy them; so that Formats // do not have any dependencies anymore. + if(g_DidTestCleanup) + g_DidTestCleanup("Document disposing"); m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() ); rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice