block focusInEvent calls, when the item tree is deconstructing

This commit is contained in:
Uwe Rathmann 2021-02-23 12:04:55 +01:00
parent d59d31ceff
commit 99f852dc83
1 changed files with 15 additions and 0 deletions

View File

@ -653,6 +653,21 @@ bool QskQuickItem::event( QEvent* event )
return true; return true;
} }
case QEvent::FocusIn:
{
if ( window() == nullptr )
{
/*
During deconstruction of the window we run into
focus changes when the items in the tree get destroyed.
Calling focusInEvent() in this state does not make sense
and often results in crashes in overloaded event handlers.
*/
return true;
}
break;
}
} }
return Inherited::event( event ); return Inherited::event( event );