diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-06 09:30:45 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-06 09:37:10 (GMT) |
commit | 1e32cdefa382b16eaffc663594ccab1dbe1faebb (patch) | |
tree | 48067bb99cd518ed655733b6207c7e800dd91660 /src | |
parent | 638b61dec0d335b12d48fe561b19a0f0f6ef83a3 (diff) | |
download | Qt-1e32cdefa382b16eaffc663594ccab1dbe1faebb.zip Qt-1e32cdefa382b16eaffc663594ccab1dbe1faebb.tar.gz Qt-1e32cdefa382b16eaffc663594ccab1dbe1faebb.tar.bz2 |
BT: Fix a crash when running a widget window modal when it has no parent
We changed the logic for determining sheets, but it seems we forgot to
take the parentWidget() into account. It's required for WindowModality
to make any sense.
Reviewed-by: Richard Moe Gustavsen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 7a586e1..f2a532f 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -295,9 +295,7 @@ bool qt_mac_is_macsheet(const QWidget *w) Qt::WindowModality modality = w->windowModality(); if (modality == Qt::ApplicationModal) return false; - if (modality == Qt::WindowModal || w->windowType() == Qt::Sheet) - return true; - return false; + return w->parentWidget() && (modality == Qt::WindowModal || w->windowType() == Qt::Sheet); } bool qt_mac_is_macdrawer(const QWidget *w) @@ -4583,11 +4581,11 @@ void QWidgetPrivate::setModal_sys() OSWindowRef windowRef = qt_mac_window_for(q); #ifdef QT_MAC_USE_COCOA - bool windowIsSheet = [windowRef styleMask] & NSDocModalWindowMask; + bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask; - if (q->windowModality() == Qt::WindowModal){ + if (windowParent && q->windowModality() == Qt::WindowModal){ // Window should be window-modal, which implies a sheet. - if (!windowIsSheet) + if (!alreadySheet) recreateMacWindow(); if ([windowRef isKindOfClass:[NSPanel class]]){ // If the primary window of the sheet parent is a child of a modal dialog, @@ -4601,7 +4599,7 @@ void QWidgetPrivate::setModal_sys() } } else { // Window shold not be window-modal, and as such, not a sheet. - if (windowIsSheet){ + if (alreadySheet){ // NB: the following call will call setModal_sys recursivly: recreateMacWindow(); windowRef = qt_mac_window_for(q); |