summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-10 22:53:02 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-12 13:53:16 +0000
commitc4e9eabc309a275efc222f4127f31ba4677259b7 (patch)
tree2601f01ece71263ce6b94ca6b868ae3a729bcaea /src/gui/painting
parentaed1e2c49f0a9ad06732d39f70b513ad2fcfdaa3 (diff)
Don't allow backingstore flush to non-raster surfaces
Change-Id: I8e85706727a8c5f7585e34e3864c8a9f48481b92 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbackingstore.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8d71d1c3a9..0dfb52e7c3 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -192,6 +192,17 @@ void QBackingStore::endPaint()
d_ptr->platformBackingStore->endPaint();
}
+static bool isRasterSurface(QWindow *window)
+{
+ switch (window->surfaceType()) {
+ case QSurface::RasterSurface:
+ case QSurface::RasterGLSurface:
+ return true;
+ default:
+ return false;
+ };
+}
+
/*!
Flushes the given \a region from the specified \a window onto the
screen.
@@ -220,6 +231,13 @@ void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &
return;
}
+ if (!isRasterSurface(window)) {
+ qWarning() << "Attempted flush to non-raster surface" << window << "of type" << window->surfaceType()
+ << (window->inherits("QWidgetWindow") ? "(consider using Qt::WA_PaintOnScreen to exclude "
+ "from backingstore sync)" : "");
+ return;
+ }
+
#ifdef QBACKINGSTORE_DEBUG
if (window && window->isTopLevel() && !qt_window_private(window)->receivedExpose) {
qWarning().nospace() << "QBackingStore::flush() called with non-exposed window "