summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-04-24 11:50:54 +0200
committerAxel Spoerl <axel.spoerl@qt.io>2023-04-25 04:26:10 +0200
commit72d6768ec130cc0508bfe433711a8f374b472fe3 (patch)
treeb19232a6a6dacd7ebcf8ffa0990df2cf0c487c3a /src/widgets
parentac0953c34d287e00559829e575b3308ccf46cb0b (diff)
Add missing nullptr check in QWidget::setFocusProxy
b1802a164b8682ed9e8956a5a19a90ade65c25d0 added handling for a parent to become focus proxy of a child. The respective 'else if' branch didn't check whether setFocusProxy() was called with a nullptr argument. This patch adds the missing nullptr check. It also adds functionality to tst_QWidget::tabOrderComboBox() to test the removal of a focus proxy, as well as the complete removal of an element from the focus chain. Change-Id: I4cb865b9ac4497fc5e2595910738fb77694f5837 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index d5dbc3f21a..d0ad169024 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6412,7 +6412,7 @@ void QWidget::setFocusProxy(QWidget * w)
d->focus_prev = oldPrev;
oldPrev->d_func()->focus_next = this;
firstChild->d_func()->focus_prev = this;
- } else if (w->isAncestorOf(this)) {
+ } else if (w && w->isAncestorOf(this)) {
// If the focus proxy is a parent, 'this' has to be inserted directly after its parent in the focus chain
// remove it from the chain and insert this into the focus chain after its parent