[Libreoffice-commits] core.git: framework/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 2 20:43:33 UTC 2021
framework/source/services/frame.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 9ccbf716ba16effb356c97c992d2cd738c44f767
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Mar 2 16:13:16 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Mar 2 21:42:46 2021 +0100
Fix null-pointer-use
Since df33714f0ecaf4d35011f2d2116e5e1a4ec75f1a "tdf#131000: sc: Add UItest"
introduced that test, UITest_calc_tests9
UITEST_TEST_NAME=forms.Forms.test_tdf131000 fails with
> /framework/source/services/frame.cxx:1451:34: runtime error: member call on null pointer of type 'vcl::Window'
> #0 0x2b0f4825f68f in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) /framework/source/services/frame.cxx:1451:34
> #1 0x2b0f59361178 in FmPropBrw::impl_ensurePropertyBrowser_nothrow(FmFormShell*) /svx/source/form/fmPropBrw.cxx:508:27
> #2 0x2b0f5936236e in FmPropBrw::StateChanged(unsigned short, SfxItemState, SfxPoolItem const*) /svx/source/form/fmPropBrw.cxx:539:13
> #3 0x2b0f4fb3a8f0 in SfxStateCache::SetState_Impl(SfxItemState, SfxPoolItem const*, bool) /sfx2/source/control/statcach.cxx:423:24
> #4 0x2b0f4fb39a28 in SfxStateCache::SetState(SfxItemState, SfxPoolItem const*, bool) /sfx2/source/control/statcach.cxx:324:5
> #5 0x2b0f4f868e30 in SfxBindings::UpdateControllers_Impl(SfxFoundCache_Impl const&, SfxPoolItem const*, SfxItemState) /sfx2/source/control/bindings.cxx:1218:16
> #6 0x2b0f4f865d34 in SfxBindings::Update_Impl(SfxStateCache&) /sfx2/source/control/bindings.cxx:271:17
> #7 0x2b0f4f86d30c in SfxBindings::Update(unsigned short) /sfx2/source/control/bindings.cxx:350:13
> #8 0x2b0f4f900fc6 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:279:24
> #9 0x2b0f4f91693f in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9
> #10 0x2b0f4f88e55f in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1060:22
> #11 0x2b0f4fd7a482 in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:758:53
> #12 0x2b0f4fd753c1 in SfxOfficeDispatch::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /sfx2/source/control/unoctitm.cxx:229:16
> #13 0x2b0f3ff4de92 in comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /comphelper/source/misc/dispatchcommand.cxx:61:12
> #14 0x2b0f3ff4e605 in comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /comphelper/source/misc/dispatchcommand.cxx:76:12
> #15 0x2b0f75905186 in UITest::executeCommand(rtl::OUString const&) /vcl/source/uitest/uitest.cxx:24:12
> #16 0x2b0f75917a20 in (anonymous namespace)::UITestUnoObj::executeCommand(rtl::OUString const&) /vcl/source/uitest/uno/uitest_uno.cxx:69:12
> #17 0x2b0fb07ea8db in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) /bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5
> #18 0x2b0fb07e4bf2 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13
> #19 0x2b0fb07e173d in unoInterfaceProxyDispatch /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
> #20 0x2b0fb5c1835a in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:235:13
> #21 0x2b0fb5c11f7a in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:78:26
> #22 0x2b0fb5ceecc7 in request /binaryurp/source/reader.cxx:85:9
> #23 0x2b0f4145fac4 in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17
> #24 0x2b0f414838eb in cppu_threadpool::ORequestThread::run() /cppu/source/threadpool/thread.cxx:165:31
> #25 0x2b0f4148f62f in threadFunc /include/osl/thread.hxx:189:15
> #26 0x2b0f37f38da8 in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:264:9
> #27 0x2b0f39ddaea4 in start_thread (/lib64/libpthread.so.0+0x7ea4)
> #28 0x2b0f3a71096c in clone (/lib64/libc.so.6+0xfe96c)
(<https://ci.libreoffice.org/job/lo_ubsan/1933/>).
The code in XFrameImpl::setComponent is like that ever since
79d6899a2f859d155d703699d0f7fe178b0c8ebf "INTEGRATION: CWS inplaceobjects" did
> - sal_Bool bHadFocus = m_eActiveState==E_FOCUS;
> + Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
> + sal_Bool bHadFocus = pOwnWindow->HasChildPathFocus();
Lets assume that pOwnWindow can legitimately be null here (i.e., it is not just
a consequence of an error that should be fixed elsewhere), and that bHadFocus
should be false in that case.
Change-Id: I73ce2c24e011d5b2ba95d09fd56bd59e47b4b991
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111841
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 9733b87a1041..f74dad8f5fd3 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -1448,7 +1448,7 @@ sal_Bool SAL_CALL XFrameImpl::setComponent(const css::uno::Reference< css::awt::
css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow;
css::uno::Reference< css::frame::XController > xOldController = m_xController;
VclPtr<vcl::Window> pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- bool bHadFocus = pOwnWindow->HasChildPathFocus();
+ bool bHadFocus = pOwnWindow != nullptr && pOwnWindow->HasChildPathFocus();
bool bWasConnected = m_bConnected;
aReadLock.clear();
/* } SAFE */
More information about the Libreoffice-commits
mailing list