-#if wxUSE_UNICODE
- // tried using wxMacCFStringHolder in the code below, but it seems
- // the CFStrings were being released before the save dialog was called,
- // causing a crash - open dialog works fine with or without wxMacCFStringHolder
- CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
- m_message.wc_str(),
- kCFStringEncodingUnicode);
-#else
- CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
- m_message.c_str(),
- CFStringGetSystemEncoding());
-#endif
- dialogCreateOptions.windowTitle = titleRef;
-#if wxUSE_UNICODE
- CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
- m_fileName.wc_str(),
- kCFStringEncodingUnicode);
-#else
- CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
- m_fileName.c_str(),
- CFStringGetSystemEncoding());
-#endif
- dialogCreateOptions.saveFileName = defaultFileNameRef;
+ wxMacCFStringHolder message(m_message, m_font.GetEncoding());
+ dialogCreateOptions.windowTitle = message;
+
+ wxMacCFStringHolder defaultFileName(m_fileName, m_font.GetEncoding());
+ dialogCreateOptions.saveFileName = defaultFileName;
+
+