[Libreoffice-commits] core.git: sfx2/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 7 18:41:07 UTC 2019
sfx2/source/appl/workwin.cxx | 8 ++++----
sfx2/source/inc/workwin.hxx | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 0f311cebd6b55eb655dc552fdd2b69943eca023b
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 7 18:57:54 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Nov 7 19:40:18 2019 +0100
Fix UBSan null-pointer-use
...during CppunitTest_sw_mailmerge (see below). Not sure why this started now,
and no idea whether pWin can legitimately be null there in
SfxWorkWindow::HidePopups_Impl, but the fix looks harmless enough to just do it.
> sfx2/source/appl/workwin.cxx:1512:52: runtime error: reference binding to null pointer of type 'const vcl::Window'
> #0 in SfxWorkWindow::HidePopups_Impl(bool, unsigned short) at sfx2/source/appl/workwin.cxx:1512:37
> #1 in SfxDispatcher::DoActivate_Impl(bool) at sfx2/source/control/dispatch.cxx:706:56
> #2 in SfxViewFrame::DoActivate(bool) at sfx2/source/view/viewfrm.cxx:1175:20
> #3 in SfxApplication::SetViewFrame_Impl(SfxViewFrame*) at sfx2/source/appl/app.cxx:308:21
> #4 in SfxViewFrame::SetViewFrame(SfxViewFrame*) at sfx2/source/view/viewfrm.cxx:3268:19
> #5 in SfxViewFrame::MakeActive_Impl(bool) at sfx2/source/view/viewfrm.cxx:1879:9
> #6 in SfxBaseController::ConnectSfxFrame_Impl(SfxBaseController::ConnectSfxFrame) at sfx2/source/view/sfxbasecontroller.cxx:1254:33
> #7 in SfxBaseController::attachFrame(com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) at sfx2/source/view/sfxbasecontroller.cxx:532:9
> #8 in (anonymous namespace)::SfxFrameLoader_Impl::impl_createDocumentView(com::sun::star::uno::Reference<com::sun::star::frame::XModel2> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, comphelper::NamedValueCollection const&, rtl::OUString const&)
> #9 in (anonymous namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) at sfx2/source/view/frmload.cxx:714:13
> #10 in framework::LoadEnv::impl_loadContent() at framework/source/loadenv/loadenv.cxx:1157:37
> #11 in framework::LoadEnv::startLoading() at framework/source/loadenv/loadenv.cxx:390:20
> #12 in framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Reference<com::sun::star::frame::XComponentLoader> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/loadenv/loadenv.cxx:171:14
> #13 in framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx:621:12
> #14 in non-virtual thunk to framework::Desktop::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at framework/source/services/desktop.cxx
> #15 in unotest::MacrosTest::loadFromDesktop(rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at unotest/source/cpp/macros_test.cxx:48:62
> #16 in SwModelTestBase::loadURL(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:764:23
> #17 in SwModelTestBase::load(rtl::OUString const&, char const*, char const*) at sw/qa/extras/inc/swmodeltestbase.hxx:719:16
> #18 in MMTest::executeMailMerge(bool) at sw/qa/extras/mailmerge/mailmerge.cxx:209:9
> #19 in testTdf95292::verify() at sw/qa/extras/mailmerge/mailmerge.cxx:593:5
> #20 in MMTest::executeMailMergeTest(char const*, char const*, char const*, bool, int, char const*) at sw/qa/extras/mailmerge/mailmerge.cxx:88:9
> #21 in testTdf95292::MailMerge() at sw/qa/extras/mailmerge/mailmerge.cxx:590:1
Change-Id: Id9499c62cca6e1fcf3ba50b82117395106a93765
Reviewed-on: https://gerrit.libreoffice.org/82246
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index d55918301614..5feb326243fc 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -884,7 +884,7 @@ SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
{
DBG_ASSERT( aChildren.size() < 255, "too many children" );
DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
- DBG_ASSERT( !FindChild_Impl(rWindow), "child registered more than once" );
+ DBG_ASSERT( !FindChild_Impl(&rWindow), "child registered more than once" );
if ( rWindow.GetParent() != pWorkWin )
@@ -951,14 +951,14 @@ void SfxWorkWindow::ReleaseChild_Impl(SfxDialogController& rController)
OSL_FAIL( "releasing unregistered child" );
}
-SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const vcl::Window& rWindow ) const
+SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const vcl::Window* rWindow ) const
{
sal_uInt16 nCount = aChildren.size();
for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos )
{
SfxChild_Impl *pChild = aChildren[nPos].get();
- if ( pChild && pChild->pWin == &rWindow )
+ if ( pChild && pChild->pWin == rWindow )
return pChild;
}
@@ -1509,7 +1509,7 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, sal_uInt16 nId )
if (pCW && pCW->GetAlignment() == SfxChildAlignment::NOALIGNMENT && pCW->GetType() != nId)
{
vcl::Window *pWin = pCW->GetWindow();
- SfxChild_Impl *pChild = FindChild_Impl(*pWin);
+ SfxChild_Impl *pChild = FindChild_Impl(pWin);
if (!pChild)
{
SAL_WARN("sfx.appl", "missing SfxChild_Impl child!");
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 1b2bfceb9be2..35cd9dd310dd 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -221,7 +221,7 @@ class SfxWorkWindow final
void CreateChildWin_Impl(SfxChildWin_Impl*,bool);
void RemoveChildWin_Impl(SfxChildWin_Impl*);
void Sort_Impl();
- SfxChild_Impl* FindChild_Impl( const vcl::Window& rWindow ) const;
+ SfxChild_Impl* FindChild_Impl( const vcl::Window* rWindow ) const;
bool RequestTopToolSpacePixel_Impl( SvBorder aBorder );
tools::Rectangle GetTopRect_Impl() const;
SvBorder Arrange_Impl();
More information about the Libreoffice-commits
mailing list