1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-11 00:53:46 +02:00

Leland's import_crash_fix.patch for bug 648

This commit is contained in:
v.audacity
2013-09-16 03:24:46 +00:00
parent 3fc912710b
commit 8bd603db70
2 changed files with 27 additions and 28 deletions

View File

@@ -942,46 +942,45 @@ void AudacityApp::InitLang( const wxString & lang )
if( mLocale )
delete mLocale;
if (lang != wxT("en"))
{
// LL: I do not know why loading translations fail on the Mac if LANG is not
// set, but for some reason it does. So wrap the creation of wxLocale
// with the default translation.
//
// 2013-09-13: I've checked this again and it is still required. Still
// no idea why.
#if defined(__WXMAC__)
wxString oldval;
bool existed;
existed = wxGetEnv(wxT("LANG"), &oldval);
wxSetEnv(wxT("LANG"), wxT("en_US"));
wxString oldval;
bool existed;
existed = wxGetEnv(wxT("LANG"), &oldval);
wxSetEnv(wxT("LANG"), wxT("en_US"));
#endif
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true);
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true);
#if defined(__WXMAC__)
if (existed) {
wxSetEnv(wxT("LANG"), oldval);
}
else {
wxUnsetEnv(wxT("LANG"));
}
if (existed) {
wxSetEnv(wxT("LANG"), oldval);
}
else {
wxUnsetEnv(wxT("LANG"));
}
#endif
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
for(unsigned int i=0; i<audacityPathList.GetCount(); i++)
mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]);
// LL: Must add the wxWidgets catalog manually since the search
// paths were not set up when mLocale was created. The
// catalogs are search in LIFO order, so add wxstd first.
mLocale->AddCatalog(wxT("wxstd"));
// LL: Must add the wxWidgets catalog manually since the search
// paths were not set up when mLocale was created. The
// catalogs are search in LIFO order, so add wxstd first.
mLocale->AddCatalog(wxT("wxstd"));
// AUDACITY_NAME is legitimately used on some *nix configurations.
#ifdef AUDACITY_NAME
mLocale->AddCatalog(wxT(AUDACITY_NAME));
mLocale->AddCatalog(wxT(AUDACITY_NAME));
#else
mLocale->AddCatalog(IPC_APPL);
mLocale->AddCatalog(IPC_APPL);
#endif
} else
mLocale = NULL;
// Initialize internationalisation (number formats etc.)
//

View File

@@ -373,8 +373,8 @@ int Importer::Import(wxString fName,
}
}
wxLogMessage(wxT("File name is %s"),(const char *) fName.mb_str());
wxLogMessage(wxT("Mime type is %s"),(const char *) mime_type.Lower().mb_str());
wxLogMessage(wxT("File name is %s"),(const char *) fName.c_str());
wxLogMessage(wxT("Mime type is %s"),(const char *) mime_type.Lower().c_str());
for (size_t i = 0; i < mExtImportItems->Count(); i++)
{
@@ -383,7 +383,7 @@ int Importer::Import(wxString fName,
wxLogDebug(wxT("Testing extensions"));
for (size_t j = 0; j < item->extensions.Count(); j++)
{
wxLogDebug(wxT("%s"), (const char *) item->extensions[j].Lower().mb_str());
wxLogDebug(wxT("%s"), (const char *) item->extensions[j].Lower().c_str());
if (wxMatchWild (item->extensions[j].Lower(),fName.Lower(), false))
{
wxLogDebug(wxT("Match!"));
@@ -505,7 +505,7 @@ int Importer::Import(wxString fName,
inFile = plugin->Open(fName);
if ( (inFile != NULL) && (inFile->GetStreamCount() > 0) )
{
wxLogMessage(wxT("Open(%s) succeeded"),(const char *) fName.mb_str());
wxLogMessage(wxT("Open(%s) succeeded"),(const char *) fName.c_str());
// File has more than one stream - display stream selector
if (inFile->GetStreamCount() > 1)
{