QNX: Fix retrieving the window group name
The code assumes that there is a root window, and crashed otherwise. Task-number: QTBUG-35121 Change-Id: Idbf0e0bfc03cd427f0aab81db88b34fe94228c81 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
parent
f03fd0d82a
commit
94c17dce04
@ -52,11 +52,13 @@ QT_BEGIN_NAMESPACE
|
|||||||
void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
|
void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
|
||||||
{
|
{
|
||||||
if (resource == "windowGroup" && window && window->screen()) {
|
if (resource == "windowGroup" && window && window->screen()) {
|
||||||
const QQnxScreen * const screen = static_cast<QQnxScreen *>(window->screen()->handle());
|
QQnxScreen * const screen = static_cast<QQnxScreen *>(window->screen()->handle());
|
||||||
if (screen) {
|
if (screen) {
|
||||||
|
screen_window_t screenWindow = reinterpret_cast<screen_window_t>(window->winId());
|
||||||
|
QQnxWindow *qnxWindow = screen->findWindow(screenWindow);
|
||||||
// We can't just call data() instead of constData() here, since that would detach
|
// 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.
|
// and the lifetime of the char * would not be long enough. Therefore the const_cast.
|
||||||
return const_cast<char *>(screen->rootWindow()->groupName().constData());
|
return qnxWindow ? const_cast<char *>(qnxWindow->groupName().constData()) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user