diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2014-01-17 20:45:57 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-28 19:32:53 +0100 |
commit | b8103a4e8174446584caf80c0bf1a006b25d9905 (patch) | |
tree | 465a99e8d15a6037e48dccbb7a7aba5530b332ea /src/plugins/platforms/qnx/qqnxbuffer.cpp | |
parent | a4ff400e25c76a32ec8252285dda043f07b19c15 (diff) |
[QNX] Introduce proper screen error handling
This patch adds a new function which does the error handling for libscreen calls.
The patch introduces following changes:
- Libscreen errors will not crash (qFatal)the application any more but rather post a
warning message.
-With the "flush-screen-context" option the screen_context is always
flushed when a screen function is called. This enables better correlation between the
time an error happens and the time it is logged.
Change-Id: Ie2456e5b746dcf917d786f3b832847d2ebbe5f1e
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Roger Maclean <rmaclean@qnx.com>
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxbuffer.cpp')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxbuffer.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index abb8a07026..e9afd5232b 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#include "qqnxglobal.h" + #include "qqnxbuffer.h" #include <QtCore/QDebug> @@ -66,34 +68,30 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) qBufferDebug() << Q_FUNC_INFO << "normal"; // Get size of buffer - errno = 0; int size[2]; - int result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size); - if (result != 0) - qFatal("QQNX: failed to query buffer size, errno=%d", errno); + Q_SCREEN_CRITICALERROR(screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_BUFFER_SIZE, size), + "Failed to query buffer size"); // Get stride of buffer - errno = 0; int stride; - result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride); - if (result != 0) - qFatal("QQNX: failed to query buffer stride, errno=%d", errno); + Q_SCREEN_CHECKERROR(screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, &stride), + "Failed to query buffer stride"); // Get access to buffer's data errno = 0; uchar *dataPtr = 0; - result = screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr); - if (result != 0) - qFatal("QQNX: failed to query buffer pointer, errno=%d", errno); + Q_SCREEN_CRITICALERROR( + screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, (void **)&dataPtr), + "Failed to query buffer pointer"); + if (dataPtr == 0) qFatal("QQNX: buffer pointer is NULL, errno=%d", errno); // Get format of buffer - errno = 0; int screenFormat; - result = screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat); - if (result != 0) - qFatal("QQNX: failed to query buffer format, errno=%d", errno); + Q_SCREEN_CHECKERROR( + screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_FORMAT, &screenFormat), + "Failed to query buffer format"); // Convert screen format to QImage format QImage::Format imageFormat = QImage::Format_Invalid; |