Add missing null check when detaching a QImage
copy() may result in a failing malloc and thus return a QImage with a null d. Hence the need for a null check before incrementing detach_no. Task-number: QTBUG-41657 Change-Id: I868c37ef355fceaa1e2fc5f8a472e3dcc84dcadd Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
This commit is contained in:
parent
42f9fd5f07
commit
ba9ac942f0
@ -1081,7 +1081,8 @@ void QImage::detach()
|
||||
if (d->ref.load() != 1 || d->ro_data)
|
||||
*this = copy();
|
||||
|
||||
++d->detach_no;
|
||||
if (d)
|
||||
++d->detach_no;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user