diff options
author | Philippe Jung <phil.jung@free.fr> | 2015-05-05 12:29:34 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-05-05 12:44:10 +0100 |
commit | aa87af58b195af94ea5b9dcb01faf09e01e76e1b (patch) | |
tree | b7b80eb618a896784248a9360b5b01556e06f109 /vcl/source/control | |
parent | ca35b597012154d655ed50e53d9d614098058ab0 (diff) |
tdf#91081 Fix LO crash after dialog closing by ESC
When control is no longuer valid, skip emission of
notification - chaining to the parent
When opening a popup dialog by right click and immediately
pressing ESC immediately, LO crashes.
A focus event listener is still registered. It triggers an event on a
component previously freed.
Change-Id: Icfc941849be5d50e2477d4e92afff844f76892d8
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/ctrl.cxx | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index e57c296a991c..9dcdfc0cea38 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -253,33 +253,36 @@ OUString Control::GetDisplayText() const bool Control::Notify( NotifyEvent& rNEvt ) { - if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) - { - if ( !mbHasControlFocus ) - { - mbHasControlFocus = true; - StateChanged( StateChangedType::CONTROL_FOCUS ); - if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) ) - // been destroyed within the handler - return true; - } - } - else + // tdf#91081 if control is not valid, skip the emission - chaining to the parent + if (mpControlData) { - if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) + if ( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) { - vcl::Window* pFocusWin = Application::GetFocusWindow(); - if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) + if ( !mbHasControlFocus ) { - mbHasControlFocus = false; + mbHasControlFocus = true; StateChanged( StateChangedType::CONTROL_FOCUS ); - if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) ) + if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_GETFOCUS, maGetFocusHdl, this ) ) // been destroyed within the handler return true; } } + else + { + if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) + { + vcl::Window* pFocusWin = Application::GetFocusWindow(); + if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) ) + { + mbHasControlFocus = false; + StateChanged( StateChangedType::CONTROL_FOCUS ); + if ( ImplCallEventListenersAndHandler( VCLEVENT_CONTROL_LOSEFOCUS, maLoseFocusHdl, this ) ) + // been destroyed within the handler + return true; + } + } + } } - return Window::Notify( rNEvt ); } |