QWidget: Remove un-needed nullptr check for oldtlw
Added in 1bd755465efa27294362925f55306f88f1800936 We already access oldtlw and oldtlw->d_func() in other places, and the source of oldtlw is a call to QWidget::window(), which returns the widget itself if it doesn't have a parent. This should also fix a CodeChecker issue where it thinks that the other unchecked accesses to oldtlw are suspicious. Add assert just in case, so we catch it explicitly if for some reason this assumption doesn't hold in the future. Pick-to: 6.5 Change-Id: Iefa9b2df6b25a993afe87e4ee90fe9d2075ebbd0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0533d1d5444c204c029ab8fbc2df1fb9f9fd6ec2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ab712f226d
commit
3e3bfcc731
@ -10759,6 +10759,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
|
||||
const bool resized = testAttribute(Qt::WA_Resized);
|
||||
const bool wasCreated = testAttribute(Qt::WA_WState_Created);
|
||||
QWidget *oldtlw = window();
|
||||
Q_ASSERT(oldtlw);
|
||||
|
||||
if (f & Qt::Window) // Frame geometry likely changes, refresh.
|
||||
d->data.fstrut_dirty = true;
|
||||
@ -10801,7 +10802,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
|
||||
|
||||
// texture-based widgets need a pre-notification when their associated top-level window changes
|
||||
// This is not under the wasCreated/newParent conditions above in order to also play nice with QDockWidget.
|
||||
if ((oldtlw && oldtlw->d_func()->usesRhiFlush) && ((!parent && parentWidget()) || (parent && parent->window() != oldtlw)))
|
||||
if (oldtlw->d_func()->usesRhiFlush && ((!parent && parentWidget()) || (parent && parent->window() != oldtlw)))
|
||||
qSendWindowChangeToTextureChildrenRecursively(this, QEvent::WindowAboutToChangeInternal);
|
||||
|
||||
// If we get parented into another window, children will be folded
|
||||
@ -10882,7 +10883,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
|
||||
|
||||
// texture-based widgets need another event when their top-level window
|
||||
// changes (more precisely, has already changed at this point)
|
||||
if ((oldtlw && oldtlw->d_func()->usesRhiFlush) && oldtlw != window())
|
||||
if (oldtlw->d_func()->usesRhiFlush && oldtlw != window())
|
||||
qSendWindowChangeToTextureChildrenRecursively(this, QEvent::WindowChangeInternal);
|
||||
|
||||
if (!wasCreated) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user