From c89dc4fdd2770ba3ad52303a2f4cb0c6403a2ecd Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 24 Oct 2012 16:27:24 -0200 Subject: QNX: Query dynamic buffer count at runtime While unlikely, there are cases in which QQnxWindow::renderBuffer() is called before the window buffers have been created. Without this check, the program will abort on QQnxBuffer constructor, since the value that will be passed to it will be of an invalid buffer. Change-Id: I9ad5926dca856570032dcf10b6975e8f3364c284 Reviewed-by: Thomas McGuire Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp') diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index b8ec91d488..11babe3aaa 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -71,7 +71,10 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore() QPaintDevice *QQnxRasterBackingStore::paintDevice() { - return m_platformWindow->renderBuffer().image(); + if (m_platformWindow->hasBuffers()) + return m_platformWindow->renderBuffer().image(); + + return 0; } void QQnxRasterBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) -- cgit v1.2.3