diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-11-17 12:48:59 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-11-19 21:55:45 +0100 |
commit | db780c4ca529a0d8d6896a08e0dc59c33b703adc (patch) | |
tree | 420f06c5eb42864123a1b673c5543c2e4472b61f /src/plugins/platforms/xcb/qxcbbackingstore.cpp | |
parent | 185c8d5adf563e19d8a969382663a988a7173614 (diff) |
xcb: Return standalone image from QXcbBackingStore::toImage()
Otherwise the original backingstore image will detach from the
m_xcb_image data on the next backingstore paint or scroll.
Pick-to: 6.2
Change-Id: I73f68d9c2e7c106951541831a5df8b97695f2001
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbbackingstore.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 796ca24265..94edd87eb7 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -850,7 +850,13 @@ QImage QXcbBackingStore::toImage() const return QImage(); m_image->flushScrolledRegion(true); - return *m_image->image(); + + QImage image = *m_image->image(); + + // Return an image that does not share QImageData with the original image, + // even if they both point to the same data of the m_xcb_image, otherwise + // painting to m_qimage would detach it from the m_xcb_image data. + return QImage(image.constBits(), image.width(), image.height(), image.format()); } QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const |