Update of /cvsroot/audacity/audacity-src/src/prefs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5616
Modified Files: DevicePrefs.cpp Log Message: Corrects: P1 (Windows Vista and 7) Crash opening Preferences when devices not enabled/connected. Index: DevicePrefs.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/prefs/DevicePrefs.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- DevicePrefs.cpp 26 Aug 2009 20:35:30 -0000 1.6 +++ DevicePrefs.cpp 12 Sep 2009 10:52:32 -0000 1.7 @@ -204,10 +204,12 @@ if (mPlay->GetCount() == 0) { playnames.Add(_("No devices found")); mPlay->Append(playnames[0], (void *) NULL); + mPlay->SetSelection(0); } if (mRecord->GetCount() == 0) { recordnames.Add(_("No devices found")); mRecord->Append(recordnames[0], (void *) NULL); + mRecord->SetSelection(0); } /* what if we have no device selected? we should choose the default on @@ -296,8 +298,11 @@ wxString DevicePrefs::GetDefaultPlayDevice(int index) { - const struct PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(index); - // get info on API + if (index < 0 || index >= Pa_GetHostApiCount()) { + return wxEmptyString; + } + + const struct PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(index); // get info on API wxLogDebug(wxT("GetDefaultPlayDevice(): HostAPI index %d, name %s"), index, wxString(apiinfo->name, wxConvLocal).c_str()); wxLogDebug(wxT("GetDefaultPlayDevice() default output %d"), apiinfo->defaultOutputDevice); const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(apiinfo->defaultOutputDevice); @@ -308,8 +313,11 @@ wxString DevicePrefs::GetDefaultRecordDevice(int index) { - const struct PaHostApiInfo *apiinfo; /* info on this API */ - apiinfo = Pa_GetHostApiInfo(index); // get info on API + if (index < 0 || index >= Pa_GetHostApiCount()) { + return wxEmptyString; + } + + const struct PaHostApiInfo *apiinfo = Pa_GetHostApiInfo(index); // get info on API wxLogDebug(wxT("GetDefaultRecordDevice(): HostAPI index %d, name %s"), index, wxString(apiinfo->name, wxConvLocal).c_str()); wxLogDebug(wxT("GetDefaultRecordDevice() default input %d"), apiinfo->defaultInputDevice); const PaDeviceInfo* devinfo = Pa_GetDeviceInfo(apiinfo->defaultInputDevice); ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs