From 6cb803883486d891d429c9143c697900d47813d6 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Wed, 9 Oct 2013 00:34:17 +0000 Subject: [PATCH] Fixed wxFileDialog assertion failure under wxOSX Cocoa. Using wxFD_FILE_MUST_EXIST in combination with an extra panel in wxFileDialog wasn't working properly. Simply remove the unused flag under OS X. Caused problems with Cocoa only (not Carbon), and at least under 10.6 and 10.8. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fldlgcmn.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/common/fldlgcmn.cpp b/src/common/fldlgcmn.cpp index 12ca3a43f0..0b02b78409 100644 --- a/src/common/fldlgcmn.cpp +++ b/src/common/fldlgcmn.cpp @@ -67,6 +67,24 @@ bool wxFileDialogBase::Create(wxWindow *parent, m_wildCard = wildCard; m_parent = parent; + +#ifdef __WXOSX__ + /* + [DS] + Remove the (for OS X unnecessary) wxFD_FILE_MUST_EXIST flag. Using it + causes problems when having an extra panel (either a custom one or + by showing the filetype filters through calling + wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1) ). + Presumably the style flag conflicts with other style flags and an + assert in wxRegion::DoOffset is triggered later on. + Another solution was to override GetWindowStyleFlag() to not include + wxFD_FILE_MUST_EXIST in its return value, but as other wxFileDialog + style flags (that are actually used) dont't seem to cause problems + this seemed an easier solution. + */ + style &= ~wxFD_FILE_MUST_EXIST; +#endif + m_windowStyle = style; m_filterIndex = 0;