Avoid bad downcast to DrawViewShell

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 16 June 2017 16:02 EDT

...in code recently introduced with cea458998745f0084271b41d90c92ad27ad071eb "tdf#106679 UI:SideBar Master Slide Button label corrected", causing CppunitTest_sd_svg_export_tests to fail with

> sd/source/ui/sidebar/SlideBackground.cxx:178:41: runtime error: downcast of address 0x6130001f60c0 which does not point to an object of type 'sd::DrawViewShell' > 0x6130001f60c0: note: object is of type 'sd::slidesorter::SlideSorterViewShell' > 4d 02 80 04 f0 16 e8 25 5c 7f 00 00 50 5e 1c 00 b0 60 00 00 80 47 64 00 10 61 00 00 90 63 87 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'sd::slidesorter::SlideSorterViewShell' > #0 0x7f5c22d85a7f in sd::sidebar::SlideBackground::Initialize() sd/source/ui/sidebar/SlideBackground.cxx:178:41 > #1 0x7f5c22d8d5fd in sd::sidebar::SlideBackground::SlideBackground(vcl::Window*, sd::ViewShellBase&, com::sun::star::uno::Reference const&, SfxBindings*) sd/source/ui/sidebar/SlideBackground.cxx:135:5 > #2 0x7f5c22d0d440 in VclPtr VclPtr::Create&, sd::ViewShellBase&, com::sun::star::uno::Reference&, SfxBindings*&>(VclPtr&, sd::ViewShellBase&, com::sun::star::uno::Reference&, SfxBindings*&) include/vcl/vclptr.hxx:131:46 > #3 0x7f5c22d013fb in sd::sidebar::PanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence const&) sd/source/ui/sidebar/PanelFactory.cxx:129:20 > #4 0x7f5c22d01b4a in non-virtual thunk to sd::sidebar::PanelFactory::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence const&) sd/source/ui/sidebar/PanelFactory.cxx > #5 0x7f5bd0ff8577 in (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence const&) framework/source/uifactory/uielementfactorymanager.cxx:443:39 > #6 0x7f5bd0ffe46a in non-virtual thunk to (anonymous namespace)::UIElementFactoryManager::createUIElement(rtl::OUString const&, com::sun::star::uno::Sequence const&) framework/source/uifactory/uielementfactorymanager.cxx > #7 0x7f5c1a9de8e7 in sfx2::sidebar::SidebarController::CreateUIElement(com::sun::star::uno::Reference const&, rtl::OUString const&, bool, sfx2::sidebar::Context const&) sfx2/source/sidebar/SidebarController.cxx:852:32 > #8 0x7f5c1a9d794d in sfx2::sidebar::SidebarController::CreatePanel(rtl::OUString const&, vcl::Window*, bool, sfx2::sidebar::Context const&, VclPtr const&) sfx2/source/sidebar/SidebarController.cxx:793:43 > #9 0x7f5c1a9d5a09 in sfx2::sidebar::SidebarController::CreatePanels(rtl::OUString const&, sfx2::sidebar::Context const&) sfx2/source/sidebar/SidebarController.cxx:625:41 > #10 0x7f5c1a9d3535 in sfx2::sidebar::SidebarController::CreateDeck(rtl::OUString const&, sfx2::sidebar::Context const&, bool) sfx2/source/sidebar/SidebarController.cxx:578:9 > #11 0x7f5c1a9ccdee in sfx2::sidebar::SidebarController::SwitchToDeck(sfx2::sidebar::DeckDescriptor const&, sfx2::sidebar::Context const&) sfx2/source/sidebar/SidebarController.cxx:708:5 > #12 0x7f5c1a9bc841 in sfx2::sidebar::SidebarController::UpdateConfigurations() sfx2/source/sidebar/SidebarController.cxx:496:13 > #13 0x7f5c1a9b9815 in sfx2::sidebar::SidebarController::notifyContextChangeEvent(com::sun::star::ui::ContextChangeEventObject const&) sfx2/source/sidebar/SidebarController.cxx:282:9 > #14 0x7f5bd059e2a9 in (anonymous namespace)::ContextChangeEventMultiplexer::BroadcastEventToSingleContainer(com::sun::star::ui::ContextChangeEventObject const&, com::sun::star::uno::Reference const&) framework/source/services/ContextChangeEventMultiplexer.cxx:269:27 > #15 0x7f5bd0590328 in (anonymous namespace)::ContextChangeEventMultiplexer::broadcastContextChangeEvent(com::sun::star::ui::ContextChangeEventObject const&, com::sun::star::uno::Reference const&) framework/source/services/ContextChangeEventMultiplexer.cxx:248:5 > #16 0x7f5c0e48b44c in ContextChangeEventMultiplexer::NotifyContextChange(com::sun::star::uno::Reference const&, vcl::EnumContext::Context) svx/source/sidebar/ContextChangeEventMultiplexer.cxx:49:27 > #17 0x7f5c0e48bfa0 in ContextChangeEventMultiplexer::NotifyContextChange(SfxViewShell*, vcl::EnumContext::Context) svx/source/sidebar/ContextChangeEventMultiplexer.cxx:59:9 > #18 0x7f5c233622a0 in sd::slidesorter::SlideSorterViewShell::Activate(bool) sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx:491:5 > #19 0x7f5c192e6f13 in SfxShell::DoActivate_Impl(SfxViewFrame*, bool) sfx2/source/control/shell.cxx:313:5 > #20 0x7f5c1909261f in SfxDispatcher::DoActivate_Impl(bool) sfx2/source/control/dispatch.cxx:743:42 > #21 0x7f5c1b09783a in SfxViewFrame::DoActivate(bool) sfx2/source/view/viewfrm.cxx:1036:20 > #22 0x7f5c1878dc80 in SfxApplication::SetViewFrame_Impl(SfxViewFrame*) sfx2/source/appl/app.cxx:313:21 > #23 0x7f5c1b09763e in SfxViewFrame::SetViewFrame(SfxViewFrame*) sfx2/source/view/viewfrm.cxx:2985:19 > #24 0x7f5c1b0b12c1 in SfxViewFrame::MakeActive_Impl(bool) sfx2/source/view/viewfrm.cxx:1611:21 > #25 0x7f5c1aff905d in SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) sfx2/source/view/sfxbasecontroller.cxx:1304:33 > #26 0x7f5c1aff1cc4 in SfxBaseController::attachFrame(com::sun::star::uno::Reference const&) sfx2/source/view/sfxbasecontroller.cxx:569:13 > #27 0x7f5c1af714a4 in (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, comphelper::NamedValueCollection const&, rtl::OUString const&) sfx2/source/view/frmload.cxx:601:18 > #28 0x7f5c1af67b6d in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) sfx2/source/view/frmload.cxx:718:13 > #29 0x7f5bd050b813 in framework::LoadEnv::impl_loadContent() framework/source/loadenv/loadenv.cxx:1081:37 > #30 0x7f5bd04f68df in framework::LoadEnv::startLoading() framework/source/loadenv/loadenv.cxx:370:20 > #31 0x7f5bd04f0a39 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) framework/source/loadenv/loadenv.cxx:156:14 > #32 0x7f5bd06c6735 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) framework/source/services/desktop.cxx:620:12 > #33 0x7f5bd06c693a in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence const&) framework/source/services/desktop.cxx > #34 0x7f5bfdb14f64 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence const&) unotest/source/cpp/macros_test.cxx:50:60 > #35 0x7f5c3523aa5d in SdSVGFilterTest::loadURL(rtl::OUString const&, char const*) sd/qa/unit/SVGExportTests.cxx:52:23 > #36 0x7f5c352392e1 in SdSVGFilterTest::load(char const*, char const*) sd/qa/unit/SVGExportTests.cxx:42:16 > #37 0x7f5c3523700e in SdSVGFilterTest::executeExport(char const*) sd/qa/unit/SVGExportTests.cxx:88:9 > #38 0x7f5c3522cf4a in SdSVGFilterTest::testSVGExportTextDecorations() sd/qa/unit/SVGExportTests.cxx:94:9 > #39 0x7f5c3525419d in void std::__invoke_impl(std::__invoke_memfun_deref, void (SdSVGFilterTest::* const&)(), SdSVGFilterTest*&) /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:227:14 > #40 0x7f5c35253f0c in std::result_of::type std::__invoke(void (SdSVGFilterTest::* const&)(), SdSVGFilterTest*&) /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:250:14 > #41 0x7f5c35253b68 in _ZNKSt12_Mem_fn_baseIM15SdSVGFilterTestFvvELb1EEclIJRPS0_EEEDTclsr3stdE8__invokedtdefpT6_M_pmfspclsr3stdE7forwardIT_Efp_EEEDpOS7_ /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:604:11 > #42 0x7f5c35253953 in void std::_Bind (SdSVGFilterTest*)>::__call(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:933:11 > #43 0x7f5c35253380 in void std::_Bind (SdSVGFilterTest*)>::operator()<, void>() /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:991:17 > #44 0x7f5c35251cf9 in std::_Function_handler (SdSVGFilterTest*)> >::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:1731:2 > #45 0x7f5c35254a3b in std::function::operator()() const /usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/functional:2127:14 > #46 0x7f5c35250377 in CppUnit::TestCaller::runTest() workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 > #47 0x7f5c7a739862 in CppUnit::TestCaseMethodFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5 > #48 0x7f5c5e7a4b64 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:39:14 > #49 0x7f5c7a6fad02 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 > #50 0x7f5c6a84e214 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12 > #51 0x7f5c7a6fad02 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 > #52 0x7f5c6e4ff426 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16 > #53 0x7f5c7a6fad02 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 > #54 0x7f5c7a66edcf in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12 > #55 0x7f5c7a6fad02 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 > #56 0x7f5c7a6f1eb2 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18 > #57 0x7f5c7a7ba5fa in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string, std::allocator > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:28 > #58 0x7f5c7a737b03 in CppUnit::TestCase::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13 > #59 0x7f5c7a73c128 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 > #60 0x7f5c7a73b1ae in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 > #61 0x7f5c7a73c128 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 > #62 0x7f5c7a73b1ae in CppUnit::TestComposite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 > #63 0x7f5c7a7f9470 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27 > #64 0x7f5c7a7b8bcb in CppUnit::TestResult::runTest(CppUnit::Test*) workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9 > #65 0x7f5c7a7fa670 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string, std::allocator > const&) workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14 > #66 0x533c2e in (anonymous namespace)::ProtectedFixtureFunctor::run() const sal/cppunittester/cppunittester.cxx:316:20 > #67 0x52fa86 in sal_main() sal/cppunittester/cppunittester.cxx:466:20 > #68 0x52e38f in main sal/cppunittester/cppunittester.cxx:373:1 > #69 0x7f5c78901400 in __libc_start_main /usr/src/debug/glibc-2.24-51-g7b60553/csu/../csu/libc-start.c:289 > #70 0x438989 in _start (workdir/LinkTarget/Executable/cppunittester+0x438989)

Change-Id: I3f819308f9525539dc0672dabb6b57d0171a7cf4 Reviewed-on: https://gerrit.libreoffice.org/38884

ce6b877 Avoid bad downcast to DrawViewShell
sd/source/ui/sidebar/SlideBackground.cxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Upstream: cgit.freedesktop.org


  • Share