From 1a63409579ff0e9ce524c09701c1ef8bd2d99f25 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 5 Jun 2020 16:09:43 +0200 Subject: QImageIO: use the new allocation checker in the format handlers Change-Id: I604d99ce476d4758a1e20b78257082911f1f1546 Task-number: QTBUG-85037 Reviewed-by: Lars Knoll --- src/plugins/imageformats/gif/qgifhandler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/plugins/imageformats/gif') 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; } -- cgit v1.2.3