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 <kevin.krammer@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
39b1bd8f45
commit
c02a2f8e76
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user