diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-17 16:50:40 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-18 14:25:13 +0000 |
commit | ba9ac942f0b27888648e21d8179f86448c953d96 (patch) | |
tree | 67c3b98c1c4b384d480125464f76f6865e6f02ca | |
parent | 42f9fd5f077fe03cbc96f3b8392d22ee2a99bab0 (diff) |
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>
-rw-r--r-- | src/gui/image/qimage.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 8ca58d4e5e..5cc1cf760f 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -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; } } |