From c02a2f8e76bcad5814134414c4c860d64880ebcd Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 18 Feb 2013 19:43:29 +0000 Subject: QNX: Don't crash with 0 by 0 sized windows In the rare event of an invalid sized window, the application crashes because libscreen doesn't like creating empty buffers. Not creating the buffers at all would also be a solution, if we didn't have QPainter crashes due do null paint devices. Change-Id: I561d0082576b6226dd52129f9640952ba46273c8 Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 7c57f6a656..ab9c94772b 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -335,7 +335,11 @@ void QQnxWindow::setBufferSize(const QSize &size) // Set window buffer size errno = 0; - int val[2] = { size.width(), size.height() }; + + // libscreen fails when creating empty buffers + const QSize nonEmptySize = size.isEmpty() ? QSize(1, 1) : size; + + int val[2] = { nonEmptySize.width(), nonEmptySize.height() }; int result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); if (result != 0) { qFatal("QQnxWindow: failed to set window buffer size, errno=%d", errno); @@ -381,7 +385,7 @@ void QQnxWindow::setBufferSize(const QSize &size) } // Cache new buffer size - m_bufferSize = size; + m_bufferSize = nonEmptySize; // Buffers were destroyed; reacquire them m_currentBufferIndex = -1; -- cgit v1.2.3