From 3cc1a32f97d2d3fe4a4c4eb83b46bdeb79cd64c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 17 Nov 2021 13:37:08 +0100 Subject: Clarify validity of image returned from QPlatformBackingStore::toImage() The backingstore may reconfigure the internal data, so clients should not assume that the image is valid beyond any new operations on the backingstore. Pick-to: 6.2 Change-Id: I137ad4f2adb45ec8bb78a989fbb5bac1e72965ce Reviewed-by: Eirik Aavitsland Reviewed-by: Paul Wicking Reviewed-by: Laszlo Agocs --- src/gui/painting/qplatformbackingstore.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gui/painting/qplatformbackingstore.cpp') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index bf7dc55644..3bd9746441 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -217,12 +217,17 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i If QPlatformIntegration::RasterGLSurface is supported, either this function or toTexture() must be implemented. + The returned image is only valid until the next operation (resize, paint, scroll, + or flush) on the backingstore. The caller must not store the return value between + calls, but instead call this function before each use, or make an explicit copy. + \sa toTexture() */ QImage QPlatformBackingStore::toImage() const { return QImage(); } + #ifndef QT_NO_OPENGL /*! May be reimplemented in subclasses to return the content of the -- cgit v1.2.3