From 9d9889682c79bacb803ef5613502e7307c1d16bd Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Mon, 20 Apr 2009 09:49:55 +0200 Subject: BT: Fix a crash when using Q(File)Dialog::open() in QCocoa. If we don't have a sheet, we need to recreate it in Cocoa. Unfortunately, we neglected to reassign the NSWindow pointer in that case, so the program would crash. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 2c3f7f1..37dc79c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4627,8 +4627,11 @@ void QWidgetPrivate::setModal_sys() if (windowParent && q->windowModality() == Qt::WindowModal){ // Window should be window-modal, which implies a sheet. - if (!alreadySheet) + if (!alreadySheet) { + // NB: the following call will call setModal_sys recursivly: recreateMacWindow(); + windowRef = qt_mac_window_for(q); + } if ([windowRef isKindOfClass:[NSPanel class]]){ // If the primary window of the sheet parent is a child of a modal dialog, // the sheet parent should not be modally shaddowed. -- cgit v0.12