diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-07-27 14:50:54 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-07-28 06:24:03 +0000 |
commit | cec4c3c563c70d846f372966f22e431b6358cece (patch) | |
tree | c3e3cf1e4f3e730ad48e44a9f6e2db1bcc2eb508 /vcl | |
parent | 4f719263ae8dc44eabfba4654f9dbed92a9c5360 (diff) |
vcl: Guard against invalid states
Got crashes here in 5.0, seem to be gone in master, but better be safe
than sorry
Change-Id: I434800f0e4a465233024b6a1ae1f48b010319f5c
Reviewed-on: https://gerrit.libreoffice.org/27594
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/accessibility.cxx | 1 | ||||
-rw-r--r-- | vcl/source/window/stacking.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 2 |
3 files changed, 4 insertions, 1 deletions
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 2b42c13e27b7..55c9d3071d36 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -143,6 +143,7 @@ css::uno::Reference< css::accessibility::XAccessible > Window::CreateAccessible( void Window::SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& x ) { + assert(mpWindowImpl); mpWindowImpl->mxAccessible = x; } diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index b1c54e502fe0..019dc0545b24 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -845,7 +845,7 @@ void Window::SetParent( vcl::Window* pNewParent ) SAL_WARN_IF( !pNewParent, "vcl", "Window::SetParent(): pParent == NULL" ); SAL_WARN_IF( pNewParent == this, "vcl", "someone tried to reparent a window to itself" ); - if( pNewParent == this ) + if( !pNewParent || pNewParent == this ) return; // check if the taskpanelist would change and move the window pointer accordingly diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 0de3312a969e..f6d460d246b2 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3143,6 +3143,8 @@ const OUString& Window::GetHelpText() const void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow ) { + assert(mpWindowImpl); + // be safe against re-entrance: first clear the old ref, then assign the new one mpWindowImpl->mxWindowPeer.clear(); mpWindowImpl->mxWindowPeer = xPeer; |