Fix checking whether GraphicsBufferView is null
If the graphics buffer view is null, GraphicsBufferView::image() will point to a valid memory location but the QImage at that address is going to be null.
This commit is contained in:
parent
b1ac04179d
commit
bc2c5bf43e
3 changed files with 6 additions and 6 deletions
|
@ -66,7 +66,7 @@ void BasicEGLSurfaceTextureWayland::update(const QRegion ®ion)
|
|||
bool BasicEGLSurfaceTextureWayland::loadShmTexture(GraphicsBuffer *buffer)
|
||||
{
|
||||
const GraphicsBufferView view(buffer);
|
||||
if (Q_UNLIKELY(!view.image())) {
|
||||
if (Q_UNLIKELY(view.isNull())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ void BasicEGLSurfaceTextureWayland::updateShmTexture(GraphicsBuffer *buffer, con
|
|||
}
|
||||
|
||||
const GraphicsBufferView view(buffer);
|
||||
if (Q_UNLIKELY(!view.image())) {
|
||||
if (Q_UNLIKELY(view.isNull())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ QPainterSurfaceTextureWayland::QPainterSurfaceTextureWayland(QPainterBackend *ba
|
|||
bool QPainterSurfaceTextureWayland::create()
|
||||
{
|
||||
const GraphicsBufferView view(m_pixmap->buffer());
|
||||
if (Q_LIKELY(view.image())) {
|
||||
if (Q_LIKELY(!view.isNull())) {
|
||||
// The buffer data is copied as the buffer interface returns a QImage
|
||||
// which doesn't own the data of the underlying wl_shm_buffer object.
|
||||
m_image = view.image()->copy();
|
||||
|
@ -32,7 +32,7 @@ bool QPainterSurfaceTextureWayland::create()
|
|||
void QPainterSurfaceTextureWayland::update(const QRegion ®ion)
|
||||
{
|
||||
const GraphicsBufferView view(m_pixmap->buffer());
|
||||
if (Q_UNLIKELY(!view.image())) {
|
||||
if (Q_UNLIKELY(view.isNull())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,8 +214,8 @@ static QImage shadowTileForBuffer(GraphicsBuffer *buffer)
|
|||
{
|
||||
if (buffer) {
|
||||
const GraphicsBufferView view(buffer);
|
||||
if (const QImage *image = view.image()) {
|
||||
return image->copy();
|
||||
if (!view.isNull()) {
|
||||
return view.image()->copy();
|
||||
}
|
||||
}
|
||||
return QImage();
|
||||
|
|
Loading…
Reference in a new issue