diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-07-31 12:21:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-07-31 15:21:30 +0200 |
commit | d2355c7f27578ba04973ece3d2e58cfb60fb0714 (patch) | |
tree | ac5ef9f9a373b8b918ee3272dee2149440324969 /desktop/qa | |
parent | 1dd8cde5cd2e692a442b6885c59634fba3737284 (diff) |
desktop: fix UB in DesktopLOKTest::testWriterCommentInsertCursor()
This was introduced in 70d3bbe11e56f12a339a5b8759b53a96b4fe84ab (sfx2:
Enable sidebar on calc and writer, but not in impress, 2019-05-02).
See <https://gerrit.libreoffice.org/76555> for an ubsan backtrace.
Change-Id: Ib9bf9b12e78a29b2a165bb4ceda144c46f38f308
Reviewed-on: https://gerrit.libreoffice.org/76735
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 112f29f4c59e..65c313cedfd0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1912,9 +1912,11 @@ void DesktopLOKTest::testWriterCommentInsertCursor() ViewCallback aView2; LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + int nView1 = SfxLokHelper::getView(); pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView1); pDocument->m_pDocumentClass->createView(pDocument); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + int nView2 = SfxLokHelper::getView(); pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView2); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0); @@ -1939,7 +1941,10 @@ void DesktopLOKTest::testWriterCommentInsertCursor() CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty()); Scheduler::ProcessEventsToIdle(); - pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast<void*>(1)); + SfxLokHelper::setView(nView1); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); + SfxLokHelper::setView(nView2); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); } #if HAVE_MORE_FONTS |