diff options
author | Sergio Martins <sergio.martins.qnx@kdab.com> | 2013-02-18 19:43:29 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-19 17:10:27 +0100 |
commit | c02a2f8e76bcad5814134414c4c860d64880ebcd (patch) | |
tree | 53389c87364c85c7f299800f4a91bce716f46910 /src/plugins/platforms | |
parent | 39b1bd8f45b9d1e0f2db0cd0d410d64422ffd992 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxwindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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; |