Fix crash in QCococaWindow::childWindowAt().

Task-number: QTBUG-31297

Change-Id: I96f4652e410334fae54a0012ed917a965becfe5c
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
bb10
Friedemann Kleint 2013-05-23 15:36:31 +02:00 committed by The Qt Project
parent c1ca272f04
commit d2ec7e05eb
1 changed files with 5 additions and 9 deletions

View File

@ -1010,15 +1010,11 @@ void QCocoaWindow::obscureWindow()
QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
{
QWindow *targetWindow = window();
foreach (QObject *child, targetWindow->children()) {
if (QWindow *childWindow = qobject_cast<QWindow *>(child)) {
if (childWindow->geometry().contains(windowPoint)) {
QCocoaWindow* platformWindow = static_cast<QCocoaWindow*>(childWindow->handle());
if (platformWindow->isExposed())
targetWindow = platformWindow->childWindowAt(windowPoint - childWindow->position());
}
}
}
foreach (QObject *child, targetWindow->children())
if (QWindow *childWindow = qobject_cast<QWindow *>(child))
if (QPlatformWindow *handle = childWindow->handle())
if (handle->isExposed() && childWindow->geometry().contains(windowPoint))
targetWindow = static_cast<QCocoaWindow*>(handle)->childWindowAt(windowPoint - childWindow->position());
return targetWindow;
}