Fix crash when resetting a QShader
shader = QShader() would crash because qAtomicAssign() requires that the other's d-pointer is non-null. Follows pattern from other usages in Qt. Pick-to: 6.2 6.4 Fixes: QTBUG-108121 Change-Id: I57d25a804340839d03f9dadcbd44e956fb259c30 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
244daf4cfc
commit
6fa2ee7f4a
@ -241,7 +241,13 @@ QShader::QShader(const QShader &other)
|
||||
QShader &QShader::operator=(const QShader &other)
|
||||
{
|
||||
if (d) {
|
||||
qAtomicAssign(d, other.d);
|
||||
if (other.d) {
|
||||
qAtomicAssign(d, other.d);
|
||||
} else {
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
} else if (other.d) {
|
||||
other.d->ref.ref();
|
||||
d = other.d;
|
||||
|
Loading…
x
Reference in New Issue
Block a user