QGraphicsWidget: Check for nullptrs in focus chain handling
The while loops terminate if focusAfter becomes nullptr (unless we break earlier), so don't dereference those pointers without checking first. Fixes static analzyer warnings 979f2d508db4d5838f6c9b296120ce60 and 481f2ec7b5851bf19414478428f944b7 Change-Id: I60fc5999907fe3b3146d7047ee1eff197719ab31 Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 95e34f7fbc0f2e9ca582278f9a772b27ebf93d5f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2c42df3034
commit
0f269e2494
@ -784,6 +784,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
|
||||
|
||||
// detach from current focus chain; skip this widget subtree.
|
||||
focusBefore->d_func()->focusNext = focusAfter;
|
||||
if (focusAfter)
|
||||
focusAfter->d_func()->focusPrev = focusBefore;
|
||||
|
||||
if (newParent) {
|
||||
@ -800,6 +801,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
|
||||
|
||||
newFocusLast->d_func()->focusNext = q;
|
||||
focusLast->d_func()->focusNext = newFocusAfter;
|
||||
if (newFocusAfter)
|
||||
newFocusAfter->d_func()->focusPrev = focusLast;
|
||||
focusPrev = newFocusLast;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user