diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-06-05 16:09:43 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-06-26 15:24:05 +0200 |
commit | 1a63409579ff0e9ce524c09701c1ef8bd2d99f25 (patch) | |
tree | d6a77e05c987fc6f6aef9f68e5a1a2f1e6731260 /src/plugins/imageformats/gif/qgifhandler.cpp | |
parent | 5dea4fe956c452be5aae2c61dd0777fdf1efe5d0 (diff) |
QImageIO: use the new allocation checker in the format handlers
Change-Id: I604d99ce476d4758a1e20b78257082911f1f1546
Task-number: QTBUG-85037
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/imageformats/gif/qgifhandler.cpp')
-rw-r--r-- | src/plugins/imageformats/gif/qgifhandler.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 078d3d596d..e895e4f91b 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -358,7 +358,10 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, state = Error; return -1; } - (*image) = QImage(swidth, sheight, format); + if (!QImageIOHandler::allocateImage(QSize(swidth, sheight), format, image)) { + state = Error; + return -1; + } bpl = image->bytesPerLine(); bits = image->bits(); if (bits) @@ -425,10 +428,9 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length, return -1; } // We just use the backing store as a byte array - backingstore = QImage(qMax(backingstore.width(), w), - qMax(backingstore.height(), h), - QImage::Format_RGB32); - if (backingstore.isNull()) { + QSize bsSize(qMax(backingstore.width(), w), qMax(backingstore.height(), h)); + if (!QImageIOHandler::allocateImage(bsSize, QImage::Format_RGB32, + &backingstore)) { state = Error; return -1; } |