Fix for select next/previous clip

Problem (at least on Windows 10): The commands no longer work properly. For a simple example, with one track selected, and the last clip selected, next clip moves to a non existant clip.
This was caused be commit baec816. In this commit, a member function was added to the struct FoundClip. Because FoundClip is no longer POD, statements such as:
AudacityProject::FoundClip result{}; no longer zero initialize the struct.

Fix: explicitly zero initialize the data members of FoundClip. I've also zero initialized the data members of FoundClipBoundary, where their are potentially similar problems, although there were no problems in my tests.
This commit is contained in:
David Bailes 2018-01-09 11:10:41 +00:00
parent 498747269c
commit 6ca8cef34a
1 changed files with 13 additions and 13 deletions

View File

@ -309,17 +309,17 @@ void OnSelectPrevClipBoundaryToCursor(const CommandContext &);
void OnSelectCursorToNextClipBoundary(const CommandContext &);
void OnSelectClipBoundary(bool next);
struct FoundTrack {
const WaveTrack* waveTrack;
int trackNumber;
bool channel;
const WaveTrack* waveTrack{};
int trackNumber{};
bool channel{};
wxString ComposeTrackName() const;
};
struct FoundClip : FoundTrack {
bool found;
double startTime;
double endTime;
int index;
bool found{};
double startTime{};
double endTime{};
int index{};
};
FoundClip FindNextClip(const WaveTrack* wt, double t0, double t1);
FoundClip FindPrevClip(const WaveTrack* wt, double t0, double t1);
@ -425,12 +425,12 @@ void OnCursorTrackEnd(const CommandContext &);
void OnCursorSelStart(const CommandContext &);
void OnCursorSelEnd(const CommandContext &);
struct FoundClipBoundary : FoundTrack {
int nFound; // 0, 1, or 2
double time;
int index1;
bool clipStart1;
int index2;
bool clipStart2;
int nFound{}; // 0, 1, or 2
double time{};
int index1{};
bool clipStart1{};
int index2{};
bool clipStart2{};
};
FoundClipBoundary FindNextClipBoundary(const WaveTrack* wt, double time);
FoundClipBoundary FindPrevClipBoundary(const WaveTrack* wt, double time);