summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-03-28 10:35:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-03-29 08:07:38 +0000
commit39a09641a1d2e1b50c831fe5ecf3dc0b0174a210 (patch)
tree56fb7bd170f4e2f4fca2f725026b0b19e2ee7384 /vcl
parent98399c291239e309769fe9a1099655343b21ccd2 (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> (cherry picked from commit d93b8268da982ad26db9e03156ce9b89f3410486) Reviewed-on: https://gerrit.libreoffice.org/35827 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/window.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index e483e2952b7c..50e7435eeb53 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2722,7 +2722,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;
@@ -2739,7 +2739,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;
@@ -2748,9 +2749,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() )
{
@@ -2765,9 +2766,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;
@@ -2777,13 +2778,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;
}
}
@@ -2792,9 +2793,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;
}
}
@@ -2803,7 +2804,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();