diff options
Diffstat (limited to 'vcl/source/window/mouse.cxx')
-rw-r--r-- | vcl/source/window/mouse.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 47116725856f..663da0ff872c 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -253,7 +253,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags ) bool bAsyncFocusWaiting = false; vcl::Window *pFrame = pSVData->maFrameData.mpFirstFrame; - while( pFrame ) + while( pFrame && pFrame->mpWindowImpl && pFrame->mpWindowImpl->mpFrameData ) { if( pFrame != mpWindowImpl->mpFrameWindow.get() && pFrame->mpWindowImpl->mpFrameData->mnFocusId ) { @@ -276,6 +276,8 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags ) bMustNotGrabFocus = true; break; } + if (!pParent->mpWindowImpl) + break; pParent = pParent->mpWindowImpl->mpParent; } @@ -333,13 +335,16 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags ) else { vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow(); - vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); - pNewOverlapWindow->mpWindowImpl->mbActive = true; - pNewOverlapWindow->Activate(); - if ( pNewRealWindow != pNewOverlapWindow ) + if ( pNewOverlapWindow && pNewOverlapWindow->mpWindowImpl ) { - pNewRealWindow->mpWindowImpl->mbActive = true; - pNewRealWindow->Activate(); + vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow(); + pNewOverlapWindow->mpWindowImpl->mbActive = true; + pNewOverlapWindow->Activate(); + if ( pNewRealWindow != pNewOverlapWindow && pNewRealWindow && pNewRealWindow->mpWindowImpl ) + { + pNewRealWindow->mpWindowImpl->mbActive = true; + pNewRealWindow->Activate(); + } } } |