From 99f852dc83ef3dc94267f022c838cdd7a1eedad8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 23 Feb 2021 12:04:55 +0100 Subject: [PATCH] block focusInEvent calls, when the item tree is deconstructing --- src/controls/QskQuickItem.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index da84cab8..9514af72 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -653,6 +653,21 @@ bool QskQuickItem::event( QEvent* event ) 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 );