Skip to content

Commit

Permalink
Fix stack-use-after-return
Browse files Browse the repository at this point in the history
...introduced with 244a447 "Make Pivot table
data source dialog async", as seen e.g. during UITest_calc_tests8:

> ==1217030==ERROR: AddressSanitizer: stack-use-after-return on address 0x7f06d7133444 at pc 0x7f069f0cb613 bp 0x7ffe24058430 sp 0x7ffe24058428
> WRITE of size 2 at 0x7f06d7133444 thread T0
>  #0 in ScAddress::operator=(ScAddress const&) at sc/inc/address.hxx:415:10
>  #1 in ScCellShell::ExecuteDataPilotDialog()::$_4::operator()(int) const at sc/source/ui/view/cellsh1.cxx:3014:42
>  #2 in void std::__invoke_impl<void, ScCellShell::ExecuteDataPilotDialog()::$_4&, int>(std::__invoke_other, ScCellShell::ExecuteDataPilotDialog()::$_4&, int&&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:60:14
>  #3 in std::enable_if<is_invocable_r_v<void, ScCellShell::ExecuteDataPilotDialog()::$_4&, int>, void>::type std::__invoke_r<void, ScCellShell::ExecuteDataPilotDialog()::$_4&, int>(ScCellShell::ExecuteDataPilotDialog()::$_4&, int&&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:110:2
>  #4 in std::_Function_handler<void (int), ScCellShell::ExecuteDataPilotDialog()::$_4>::_M_invoke(std::_Any_data const&, int&&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:291:9
>  #5 in std::function<void (int)>::operator()(int) const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:560:9
>  #6 in Dialog::EndDialog(long) at vcl/source/window/dialog.cxx:1137:9
>  #7 in Dialog::ResponseHdl(Button*) at vcl/source/window/dialog.cxx:1391:5
>  #8 in Dialog::LinkStubResponseHdl(void*, Button*) at vcl/source/window/dialog.cxx:1376:1
>  #9 in Link<Button*, void>::Call(Button*) const at include/tools/link.hxx:111:45
>  #10 in Button::Click()::$_0::operator()() const at vcl/source/control/button.cxx:124:87
>  #11 in void std::__invoke_impl<void, Button::Click()::$_0&>(std::__invoke_other, Button::Click()::$_0&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:60:14
>  #12 in std::enable_if<is_invocable_r_v<void, Button::Click()::$_0&>, void>::type std::__invoke_r<void, Button::Click()::$_0&>(Button::Click()::$_0&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:110:2
>  #13 in std::_Function_handler<void (), Button::Click()::$_0>::_M_invoke(std::_Any_data const&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:291:9
>  #14 in std::function<void ()>::operator()() const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:560:9
>  #15 in Control::ImplCallEventListenersAndHandler(VclEventId, std::function<void ()> const&) at vcl/source/control/ctrl.cxx:315:13
>  #16 in Button::Click() at vcl/source/control/button.cxx:124:5
>  #17 in ButtonUIObject::execute(rtl::OUString const&, std::__debug::map<rtl::OUString const, rtl::OUString, std::less<rtl::OUString const>, std::allocator<std::pair<rtl::OUString const, rtl::OUString> > > const&) at vcl/source/uitest/uiobject.cxx:614:19
>  #18 in UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0::operator()() const at vcl/source/uitest/uno/uiobject_uno.cxx:124:16
>  #19 in void std::__invoke_impl<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>(std::__invoke_other, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:60:14
>  #20 in std::enable_if<is_invocable_r_v<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>, void>::type std::__invoke_r<void, UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&>(UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/invoke.h:110:2
>  #21 in std::_Function_handler<void (), UIObjectUnoObj::executeAction(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)::$_0>::_M_invoke(std::_Any_data const&) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:291:9
>  #22 in std::function<void ()>::operator()() const at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:560:9
>  #23 in (anonymous namespace)::ExecuteWrapper::ExecuteActionHdl(Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:83:13
>  #24 in (anonymous namespace)::ExecuteWrapper::LinkStubExecuteActionHdl(void*, Timer*) at vcl/source/uitest/uno/uiobject_uno.cxx:78:1
>  #25 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
>  #26 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
>  #27 in Scheduler::ProcessTaskScheduling() at vcl/source/app/scheduler.cxx:486:20
>  #28 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:288:5
>  #29 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
>  #30 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:210:53
>  #31 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:463:21
>  #32 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:447:48
>  #33 in Application::Yield() at vcl/source/app/svapp.cxx:511:5
>  #34 in Application::Execute() at vcl/source/app/svapp.cxx:426:9
>  #35 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1588:13
>  #36 in ImplSVMain() at vcl/source/app/svmain.cxx:196:35
>  #37 in SVMain() at vcl/source/app/svmain.cxx:228:12
>  #38 in soffice_main at desktop/source/app/sofficemain.cxx:98:12
>  #39 in sal_main at desktop/source/app/main.c:49:15
>  #40 in main at desktop/source/app/main.c:47:1

Change-Id: I7ff5148f4bf9170fc7add312053de5acc153125b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106919
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
  • Loading branch information
stbergmann authored and timar committed Apr 7, 2021
1 parent 6209b6b commit f72f9a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sc/source/ui/view/cellsh1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2955,7 +2955,7 @@ void ScCellShell::ExecuteDataPilotDialog()
}

pTypeDlg->StartExecuteAsync([this, pTypeDlg, pTabViewShell,
pScMod, pFact, &rDoc, &rMark, &aDestPos](int nResult) {
pScMod, pFact, &rDoc, &rMark, aDestPos](int nResult) mutable {
const char* pSrcErrorId = nullptr;
std::unique_ptr<ScDPObject> pNewDPObject;

Expand Down

0 comments on commit f72f9a6

Please sign in to comment.