summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPasi Matilainen <pasi.matilainen@digia.com>2012-02-13 07:50:31 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-04 07:41:02 (GMT)
commit37212b8c063b456b036f87841e596ee7d857052f (patch)
tree26270f2b6c612d437315ec4beb6a815e76cb4672 /src/gui
parentedc6fae534835a2c72edffb52255fe522a37928f (diff)
downloadQt-37212b8c063b456b036f87841e596ee7d857052f.zip
Qt-37212b8c063b456b036f87841e596ee7d857052f.tar.gz
Qt-37212b8c063b456b036f87841e596ee7d857052f.tar.bz2
Fix crash when opening a file dialog in sandbox on Mac
The sandboxed version of the native file dialog does not implement NSWindow methods, and does not respond to validateVisibleColumns. Calling these methods on a sandboxed file dialog results in a crash, so check support for the methods using respondsToSelector before calling. Task-number: QTBUG-21609 Change-Id: I7de7d8b24dab886a261ae02c395a4a22f0f489c0 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index a858aa7..5526eec 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -154,7 +154,8 @@ QT_USE_NAMESPACE
mOpenPanel = 0;
}
- [mSavePanel setLevel:NSModalPanelWindowLevel];
+ if ([mSavePanel respondsToSelector:@selector(setLevel:)])
+ [mSavePanel setLevel:NSModalPanelWindowLevel];
[mSavePanel setDelegate:self];
mQDirFilter = new QT_PREPEND_NAMESPACE(QDir::Filters)(qDirFilter);
mFileOptions = new QT_PREPEND_NAMESPACE(QFileDialog::Options)(fileOptions);
@@ -204,7 +205,8 @@ QT_USE_NAMESPACE
delete mSelectedNameFilter;
delete mCurrentSelection;
- [mSavePanel orderOut:mSavePanel];
+ if ([mSavePanel respondsToSelector:@selector(orderOut:)])
+ [mSavePanel orderOut:mSavePanel];
[mSavePanel setAccessoryView:nil];
[mPopUpButton release];
[mTextField release];
@@ -224,7 +226,8 @@ QT_USE_NAMESPACE
- (void)closePanel
{
*mCurrentSelection = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)([mSavePanel filename]);
- [mSavePanel close];
+ if ([mSavePanel respondsToSelector:@selector(close)])
+ [mSavePanel close];
}
- (void)showModelessPanel
@@ -361,7 +364,8 @@ QT_USE_NAMESPACE
Q_UNUSED(sender);
QString selection = mNameFilterDropDownList->value([mPopUpButton indexOfSelectedItem]);
*mSelectedNameFilter = [self findStrippedFilterWithVisualFilterName:selection];
- [mSavePanel validateVisibleColumns];
+ if ([mSavePanel respondsToSelector:@selector(validateVisibleColumns)])
+ [mSavePanel validateVisibleColumns];
[self updateProperties];
if (mPriv)
mPriv->QNSOpenSavePanelDelegate_filterSelected([mPopUpButton indexOfSelectedItem]);
@@ -406,8 +410,11 @@ QT_USE_NAMESPACE
ext.prepend(mPriv->defaultSuffix);
[mSavePanel setAllowedFileTypes:ext.isEmpty() ? nil : QT_PREPEND_NAMESPACE(qt_mac_QStringListToNSMutableArray(ext))];
- if ([mSavePanel isVisible])
- [mOpenPanel validateVisibleColumns];
+ if ([mSavePanel respondsToSelector:@selector(isVisible)] && [mSavePanel isVisible])
+ {
+ if ([mOpenPanel respondsToSelector:@selector(validateVisibleColumns)])
+ [mOpenPanel validateVisibleColumns];
+ }
}
- (void)panelSelectionDidChange:(id)sender