diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-11-11 16:54:59 -0500 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-10-02 19:46:45 +0200 |
commit | 66d6bed63c6be5feb8952e83296c41f219cd443f (patch) | |
tree | 3daa015bb04ce9a05cd179aee00a783027d72cf5 /desktop/qa | |
parent | e07492fd77e8a750b5b75a06f792bedaebf2ce77 (diff) |
LOK: disable LOKit in unit-tests only after destroying all
When we disable LOKit at the end of a unit-test, we do so
before any of the smart-pointers go out of scope. These
instances are then destroyed when LOKit is no longer active,
in spite of the fact that they were created while it was.
This leaves some dialog/window routing notifiers dangling,
which cause assertion failures and access-after-free (when
they are invoked on destruction inadvertently). The latter
issue was found with 'make CppunitTest_sd_tiledrendering
VALGRIND=memcheck'.
The fix is to move these flags to the setup and teardown
stages of cpp-unit.
Change-Id: I50bc240b96026880a2e278ea530b1e1810b8e28d
Reviewed-on: https://gerrit.libreoffice.org/80028
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/80056
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c08cdaeb41bc..d2e6b1890f97 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -71,6 +71,7 @@ public: comphelper::LibreOfficeKit::setActive(true); UnoApiTest::setUp(); + mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()))); SfxApplication::GetOrCreate(); }; @@ -2208,7 +2209,6 @@ void DesktopLOKTest::readFileIntoByteVector(OUString const & sFilename, std::vec void DesktopLOKTest::testGetSignatureState_Signed() { - comphelper::LibreOfficeKit::setActive(); LibLODocument_Impl* pDocument = loadDoc("signed.odt"); Scheduler::ProcessEventsToIdle(); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); @@ -2236,7 +2236,6 @@ void DesktopLOKTest::testGetSignatureState_Signed() void DesktopLOKTest::testGetSignatureState_NonSigned() { - comphelper::LibreOfficeKit::setActive(); LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); Scheduler::ProcessEventsToIdle(); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); @@ -2246,8 +2245,6 @@ void DesktopLOKTest::testGetSignatureState_NonSigned() void DesktopLOKTest::testInsertCertificate_DER_ODT() { - comphelper::LibreOfficeKit::setActive(); - // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); utl::TempFile aTempFile; @@ -2299,8 +2296,6 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT() void DesktopLOKTest::testInsertCertificate_PEM_ODT() { - comphelper::LibreOfficeKit::setActive(); - // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); utl::TempFile aTempFile; @@ -2359,8 +2354,6 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() void DesktopLOKTest::testInsertCertificate_PEM_DOCX() { - comphelper::LibreOfficeKit::setActive(); - // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.docx"); utl::TempFile aTempFile; @@ -2422,8 +2415,6 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() // FIXME: needs investigation ... return; - comphelper::LibreOfficeKit::setActive(); - // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); utl::TempFile aTempFile; @@ -2480,8 +2471,6 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() void DesktopLOKTest::testTextSelectionHandles() { - comphelper::LibreOfficeKit::setActive(); - LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); @@ -2521,7 +2510,6 @@ void DesktopLOKTest::testTextSelectionHandles() void DesktopLOKTest::testDialogPaste() { - comphelper::LibreOfficeKit::setActive(); LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); Scheduler::ProcessEventsToIdle(); @@ -2548,9 +2536,6 @@ void DesktopLOKTest::testDialogPaste() void DesktopLOKTest::testComplexSelection() { - // needed for SwTransferable to cope with the selection. - comphelper::LibreOfficeKit::setActive(); - // Start with a blank text file and add contents. LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); // LibLODocument_Impl* pDocument = loadDoc("sheet_with_image.ods"); |