From 9ab3a69c652575b03158ba09bc63fcb18ca3b3f7 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 29 Oct 2018 09:18:38 +0100 Subject: [PATCH] QmlDesigner: Crash fix This is likely to fix a crash we could only reproduce with the Qt Design Studio release on one machine. Task-number: QDS-270 Change-Id: Idc33ba145169613b866903fa5e259f8cd6ec4ee8 Reviewed-by: Tim Jenssen --- share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp b/share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp index 798e448108b..f36a1d5efbf 100644 --- a/share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp +++ b/share/qtcreator/qml/qmlpuppet/container/imagecontainer.cpp @@ -196,7 +196,10 @@ static void readSharedMemory(qint32 key, ImageContainer &container) QImage image = QImage(imageWidth, imageHeight, QImage::Format(imageFormat)); - std::memcpy(image.bits(), reinterpret_cast(sharedMemory.constData()) + 5, byteCount); + if (image.isNull()) + qDebug() << Q_FUNC_INFO << "Not able to create image:" << imageWidth << imageHeight << imageFormat; + else + std::memcpy(image.bits(), reinterpret_cast(sharedMemory.constData()) + 5, byteCount); container.setImage(image);