[Libreoffice-commits] core.git: vcl/source
Philippe Jung
phil.jung at free.fr
Tue May 5 04:37:44 PDT 2015
vcl/source/control/ctrl.cxx | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
New commits:
commit aa87af58b195af94ea5b9dcb01faf09e01e76e1b
Author: Philippe Jung <phil.jung at free.fr>
Date: Tue May 5 12:29:34 2015 +0200
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
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index e57c296..9dcdfc0 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 );
}
More information about the Libreoffice-commits
mailing list