diff options
author | Rafael Roquetto <rafael.roquetto.qnx@kdab.com> | 2012-11-29 17:19:02 -0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-03 08:32:44 +0100 |
commit | 876f979bb180b3d3a53a64b4e4716d7bc80b3fb5 (patch) | |
tree | 2a9324f2aa4795b2b33cd2fec8c501a78eb71043 /src/plugins/platforms | |
parent | a1a4e13a83178dd94fd778f927caf5ccb75de42b (diff) | |
download | qt4-tools-876f979bb180b3d3a53a64b4e4716d7bc80b3fb5.tar.gz |
QNX: Move buffer count check to appropriate location
The buffer count check should take place right after buffers are created. For
some reason, the buffer count value inside libscreen may become incosistent during
the course of the program.
cherry-picked from qt5/qtbase 1b95d3331cb43fda36f92189ddce4e4c45bd47ea
Change-Id: Id542b3f8633ce118b0c125d47f3eda63ca31fe5e
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/blackberry/qbbwindow.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/platforms/blackberry/qbbwindow.cpp b/src/plugins/platforms/blackberry/qbbwindow.cpp index 284aabf53d..e87febb903 100644 --- a/src/plugins/platforms/blackberry/qbbwindow.cpp +++ b/src/plugins/platforms/blackberry/qbbwindow.cpp @@ -319,6 +319,18 @@ void QBBWindow::setBufferSize(const QSize &size) if (result != 0) { qFatal("QBBWindow: failed to create window buffers, errno=%d", errno); } + + // check if there are any buffers available + int bufferCount = 0; + result = screen_get_window_property_iv(mWindow, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount); + + if (result != 0) { + qFatal("QBBWindow: failed to query window buffer count, errno=%d", errno); + } + + if (bufferCount != MAX_BUFFER_COUNT) { + qFatal("QBBWindow: invalid buffer count. Expected = %d, got = %d", MAX_BUFFER_COUNT, bufferCount); + } } // cache new buffer size @@ -356,22 +368,10 @@ QBBBuffer &QBBWindow::buffer(QBBWindow::Buffer bufferIndex) // check if render buffer is invalid if (mCurrentBufferIndex == -1) { - // check if there are any buffers available - int bufferCount = 0; - int result = screen_get_window_property_iv(mWindow, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount); - - if (result != 0) { - qFatal("QBBWindow: failed to query window buffer count, errno=%d", errno); - } - - if (bufferCount != MAX_BUFFER_COUNT) { - qFatal("QBBWindow: invalid buffer count. Expected = %d, got = %d", MAX_BUFFER_COUNT, bufferCount); - } - // get all buffers available for rendering errno = 0; screen_buffer_t buffers[MAX_BUFFER_COUNT]; - result = screen_get_window_property_pv(mWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers); + const int result = screen_get_window_property_pv(mWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers); if (result != 0) { qFatal("QBBWindow: failed to query window buffers, errno=%d", errno); } |