1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-27 07:43:50 +01:00

Fixes per Vigilant Sentry (http://www.vigilantsw.com/)

* Fix memory leaks.

* Add comments about initializations and checking for successful results.

* Add checks for NULL deref.

* Consistency in "TODO" vs "TO-DO" comments!
This commit is contained in:
v.audacity
2012-02-08 05:09:14 +00:00
parent 5b3f3f71ea
commit 5f5b9778de
23 changed files with 83 additions and 34 deletions

View File

@@ -391,6 +391,8 @@ void KeyConfigPrefs::SetKeyForSelected( const wxString & key )
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
{
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount())
return;
@@ -414,6 +416,8 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & e)
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
{
mKey->Clear();
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
return;
}
@@ -500,6 +504,8 @@ void KeyConfigPrefs::OnCategory(wxCommandEvent & e)
void KeyConfigPrefs::OnItemSelected(wxListEvent & e)
{
mCommandSelected = e.GetIndex();
// ANSWER-ME: mCommandSelected is unsigned, so there's no point checking whether it's < 0.
// Should it be a signed int instead or remove that check?
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
mKey->SetLabel(wxT(""));
return;

View File

@@ -249,7 +249,7 @@ void PrefsDialog::OnOK(wxCommandEvent & event)
// set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well.
// Instead allow it because unlike recording, for example, monitoring
// is not clearly something that should prohibit opening prefs.
// TO-DO: We *could* be smarter in this method and call HandleDeviceChange()
// TODO: We *could* be smarter in this method and call HandleDeviceChange()
// only when the device choices actually changed. True of lots of prefs!
// As is, we always stop monitoring before handling the device change.
if (gAudioIO->IsMonitoring())