summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/control/ctrl.cxx39
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 );
}