summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 25f1ea5236..1825a463d0 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -311,9 +311,12 @@ QPaintDevice *QXcbBackingStore::paintDevice()
void QXcbBackingStore::beginPaint(const QRegion &region)
{
+ if (!m_image && !m_size.isEmpty())
+ resize(m_size, QRegion());
+
if (!m_image)
return;
-
+ m_size = QSize();
m_paintRegion = region;
m_image->preparePaint(m_paintRegion);
@@ -420,7 +423,8 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &)
return;
Q_XCB_NOOP(connection());
- QXcbScreen *screen = static_cast<QXcbScreen *>(window()->screen()->handle());
+
+ QXcbScreen *screen = window()->screen() ? static_cast<QXcbScreen *>(window()->screen()->handle()) : 0;
QPlatformWindow *pw = window()->handle();
if (!pw) {
window()->create();
@@ -429,6 +433,11 @@ void QXcbBackingStore::resize(const QSize &size, const QRegion &)
QXcbWindow* win = static_cast<QXcbWindow *>(pw);
delete m_image;
+ if (!screen) {
+ m_image = 0;
+ m_size = size;
+ return;
+ }
m_image = new QXcbShmImage(screen, size, win->depth(), win->imageFormat());
// Slow path for bgr888 VNC: Create an additional image, paint into that and
// swap R and B while copying to m_image after each paint.