diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 8958a5c1e2..24af5c2683 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -52,11 +52,13 @@ QT_BEGIN_NAMESPACE void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { if (resource == "windowGroup" && window && window->screen()) { - const QQnxScreen * const screen = static_cast(window->screen()->handle()); + QQnxScreen * const screen = static_cast(window->screen()->handle()); if (screen) { + screen_window_t screenWindow = reinterpret_cast(window->winId()); + QQnxWindow *qnxWindow = screen->findWindow(screenWindow); // We can't just call data() instead of constData() here, since that would detach // and the lifetime of the char * would not be long enough. Therefore the const_cast. - return const_cast(screen->rootWindow()->groupName().constData()); + return qnxWindow ? const_cast(qnxWindow->groupName().constData()) : 0; } }