diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-03-31 11:23:40 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-04-13 10:16:05 +0200 |
commit | c379659f5f51ae14331e5bdd365ef229c9a4c9c9 (patch) | |
tree | 2dcf548182f62205f4252f469a2627cdda6d4afe | |
parent | 94b624586931d8aead96195dd498310ac8e8bdd6 (diff) |
Ensure the ninepatch image is detached
Applied the change to the file at different location in 5.15 as
the automatic merge fails.
Fixes: QTBUG-88162
Change-Id: Id83d04fce668a3e05d150c086abdecc9d59e51e8
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 837b3795c237d20dfca4be46e10697e1cd300e60)
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/imports/controls/imagine/qquickninepatchimage.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp index f2884415..dfad628b 100644 --- a/src/imports/controls/imagine/qquickninepatchimage.cpp +++ b/src/imports/controls/imagine/qquickninepatchimage.cpp @@ -454,6 +454,13 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode qsgnode_set_description(patchNode, QString::fromLatin1("QQuickNinePatchImage: '%1'").arg(d->url.toString())); #endif + // The image may wrap non-owned data (due to pixmapChange). Ensure we never + // pass such an image to the scenegraph, because with a separate render + // thread the data may become invalid (in a subsequent pixmapChange on the + // gui thread) by the time the renderer gets to do something with the QImage + // passed in here. + image.detach(); + QSGTexture *texture = window()->createTextureFromImage(image); patchNode->initialize(texture, sz * d->devicePixelRatio, image.size(), d->xDivs, d->yDivs, d->devicePixelRatio); return patchNode; |