QmlDesigner: Use unique image key for each import 3D preview icon

The shared memory is allocated based on the key, so if every icon
is sent with same key, they will use the same shared memory. If QDS
side doesn't read the image before the next image is written into the
shared memory, QDS side will get wrong image if all images use same
key.

Fixes: QDS-13013
Change-Id: Ie8188520a76ca057a5b0f0927a7726652609fa35
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-06-17 15:12:55 +03:00
parent e40720eda1
commit e50704d961

View File

@@ -345,7 +345,8 @@ void Qt5Import3dNodeInstanceServer::render()
if (!data.name.isEmpty()) {
QSizeF iconSize = m_iconView3D->size();
QImage iconImage = renderImage.copy(0, 0, iconSize.width(), iconSize.height());
ImageContainer imgContainer(0, iconImage, 1000001);
static qint32 renderId = 1000001;
ImageContainer imgContainer(0, iconImage, ++renderId);
QVariantList cmdData;
cmdData.append(data.name);
cmdData.append(QVariant::fromValue(imgContainer));