diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2017-03-28 10:35:50 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2017-03-29 07:57:22 +0000 |
commit | d93b8268da982ad26db9e03156ce9b89f3410486 (patch) | |
tree | 8ac38d5cad4dcafcb8c277410bbd58c81c7d982e /vcl | |
parent | 5a725d1fde7381ef9c02afcb639235a11e52182c (diff) |
Attempted fix for mirrored geometry crasher.
Only plausible cause is pWindow->GetParent() being null, while
we have a pParent which has to be valid.
http://crashreport.libreoffice.org/stats/crash_details/6161398d-17b6-4a93-aa70-a559efa07868
Code was initially introduced in this form:
commit 4716735ba7d0ad133ff018481f94d6b4f201bbd9
Author: Stephan Schäfer <ssa@openoffice.org>
Date: Thu Sep 19 15:46:19 2002 +0000
#103362# improve positioning and resizing of system windows
No public report, sadly. And modified by
commit fba46c6efd08d50fee92cc11546f3ed253a57af8
Author: Chris Sherlock <chris.sherlock79@gmail.com>
Date: Mon Feb 3 16:46:04 2014 +1100
fdo#74424 Use Window::GetOutDev() to access ImplReMirrored()
Part of the decoupling of Window from OutputDevice. We now get
he Window's OutputDevice instance and manipulate this. Do not rely
on the inherited function.
where the GetParent()/pWindow->GetParent() problem surfaces
Change-Id: Ia261028a4719525135e3fe4b00074427c1d9df6c
Reviewed-on: https://gerrit.libreoffice.org/35796
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/window.cxx | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 848fdc942b43..c0186a7049ff 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2725,7 +2725,7 @@ void Window::setPosSizePixel( long nX, long nY, mpWindowImpl->mbDefSize = false; // The top BorderWindow is the window which is to be positioned - vcl::Window* pWindow = this; + VclPtr<vcl::Window> pWindow = this; while ( pWindow->mpWindowImpl->mpBorderWindow ) pWindow = pWindow->mpWindowImpl->mpBorderWindow; @@ -2742,7 +2742,8 @@ void Window::setPosSizePixel( long nX, long nY, nHeight = pWindow->mnOutHeight; sal_uInt16 nSysFlags=0; - vcl::Window *pParent = GetParent(); + VclPtr<vcl::Window> pParent = GetParent(); + VclPtr<vcl::Window> pWinParent = pWindow->GetParent(); if( nFlags & PosSizeFlags::Width ) nSysFlags |= SAL_FRAME_POSSIZE_WIDTH; @@ -2751,9 +2752,9 @@ void Window::setPosSizePixel( long nX, long nY, if( nFlags & PosSizeFlags::X ) { nSysFlags |= SAL_FRAME_POSSIZE_X; - if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) + if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nX += pParent->mnOutOffX; + nX += pWinParent->mnOutOffX; } if( pParent && pParent->ImplIsAntiparallel() ) { @@ -2768,9 +2769,9 @@ void Window::setPosSizePixel( long nX, long nY, { // --- RTL --- make sure the old right aligned position is not changed // system windows will always grow to the right - if ( pParent ) + if ( pWinParent ) { - OutputDevice *pParentOutDev = pParent->GetOutDev(); + OutputDevice *pParentOutDev = pWinParent->GetOutDev(); if( pParentOutDev->HasMirroredGraphics() ) { long myWidth = nOldWidth; @@ -2780,13 +2781,13 @@ void Window::setPosSizePixel( long nX, long nY, myWidth = nWidth; nFlags |= PosSizeFlags::X; nSysFlags |= SAL_FRAME_POSSIZE_X; - nX = pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration + - pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX; + nX = pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration + + pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX; if(!(nFlags & PosSizeFlags::Y)) { nFlags |= PosSizeFlags::Y; nSysFlags |= SAL_FRAME_POSSIZE_Y; - nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - + nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nTopDecoration; } } @@ -2795,9 +2796,9 @@ void Window::setPosSizePixel( long nX, long nY, if( nFlags & PosSizeFlags::Y ) { nSysFlags |= SAL_FRAME_POSSIZE_Y; - if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) + if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nY += pParent->mnOutOffY; + nY += pWinParent->mnOutOffY; } } @@ -2806,7 +2807,7 @@ void Window::setPosSizePixel( long nX, long nY, // check for min/max client size and adjust size accordingly // otherwise it may happen that the resize event is ignored, i.e. the old size remains // unchanged but ImplHandleResize() is called with the wrong size - SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow ); + SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow.get() ); if( pSystemWindow ) { Size aMinSize = pSystemWindow->GetMinOutputSizePixel(); |