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>
This commit is contained in:
Tor Arne Vestbø 2019-02-10 22:53:02 +01:00
parent aed1e2c49f
commit c4e9eabc30

View File

@ -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 "