From 6ca8cef34a8f431f5bd506cbd241107c5e772b6f Mon Sep 17 00:00:00 2001 From: David Bailes Date: Tue, 9 Jan 2018 11:10:41 +0000 Subject: [PATCH] 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. --- src/Menus.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Menus.h b/src/Menus.h index 3191f887b..b6649b201 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -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);