-#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 = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
- (const unsigned short*)m_message.wc_str(),
- m_message.Len() );
-#else
- CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
- m_message.c_str(),
- CFStringGetSystemEncoding());
-#endif
- dialogCreateOptions.windowTitle = titleRef;
-#if wxUSE_UNICODE
- CFStringRef defaultFileNameRef = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
- (const unsigned short*)m_fileName.wc_str(),
- m_fileName.Len() );
-#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;
+
+