From 03392e1edffee2ea7fdbcbee546dd5b11a448bc2 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 21 May 2012 16:08:15 +0100 Subject: QNX: Register for navigator events before any window creation This prevents a possible race condition in which the nvaigator service notices that we have created a window and starts sending us messages possibly before we have registered with bps for navigator messages. This resulted in applications sometimes missing navigator messages at startup. Change-Id: I362fd782d7798990bc196f23e07b58293b13275d Reviewed-by: Giuseppe D'Angelo Reviewed-by: Nicolas Arnaud-Cormos --- src/plugins/platforms/qnx/qqnxintegration.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 2f4e8cd19a..59d7f13f8a 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -146,9 +146,6 @@ QQnxIntegration::QQnxIntegration() QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection); #endif - // Create displays for all possible screens (which may not be attached) - createDisplays(); - #if !defined(QT_NO_OPENGL) // Initialize global OpenGL resources QQnxGLContext::initialize(); @@ -184,14 +181,25 @@ QQnxIntegration::QQnxIntegration() #if defined(Q_OS_BLACKBERRY) QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps; m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps); - Q_FOREACH (QQnxScreen *screen, m_screens) - m_bpsEventFilter->registerForScreenEvents(screen); - m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher); m_virtualKeyboard = virtualKeyboardBps; #endif + // Create displays for all possible screens (which may not be attached). We have to do this + // *after* the call to m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher). The + // reason for this is that we have to be registered for NAVIGATOR events before we create the + // QQnxScreen objects, and hence the QQnxRootWindow's. It is when the NAVIGATOR service sees + // the window creation that it starts sending us messages which results in a race if we + // create the displays first. + createDisplays(); + +#if defined(Q_OS_BLACKBERRY) + // Register for screen domain events with bps + Q_FOREACH (QQnxScreen *screen, m_screens) + m_bpsEventFilter->registerForScreenEvents(screen); +#endif + if (m_virtualKeyboard) { // TODO check if we need to do this for all screens or only the primary one QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)), -- cgit v1.2.3