Repository navigation
Fix project corruption caused by removing empty clips on load - #12544
Conversation
📝 Walkthrough
Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
51262e04-e31a-4025-a779-898fb793f788
📒 Files selected for processing: 4
au3/libraries/au3-wave-track/WaveTrack.cppau3/libraries/au3-wave-track/WaveTrackUtilities.cppau3/libraries/au3-wave-track/WaveTrackUtilities.hsrc/au3wrap/internal/au3project.cpp
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
6506ae8 to
1153d81
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Clean empty clips in the legacy load path after FixTracks. · WaveTrack.cpp:607-690
au3/libraries/au3-wave-track/WaveTrack.cpp:607-690
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClean empty clips in the legacy load path after
FixTracks.
ReadProjectFilesnapshots the saved tracks beforeFixTracks, but the legacy path does not callWaveTrackUtilities::RemoveEmptyClipsorSanitizeafterward. SinceLinkConsistencyFixno longer removes empty clips, a successful legacy load can commit empty mono or unlinked clips. Add the cleanup afterFixTracks; do not restore it inLinkConsistencyFix, because the wrapper load path must delay cleanup until after its saved-state update.Suggested fix
FixTracks( tracks, // Keep at most one of the error messages [&](const auto& errorMessage) { otherError = errorMessage; err = true; }, [&](const auto& unlinkReason) { linkTypeChangeReason = unlinkReason; }); + tracks.Any().Visit( + [](WaveTrack& track) { + WaveTrackUtilities::RemoveEmptyClips(track); + }, + [](Track&) {}); + if (!err) {
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
46b277df-597f-4a6c-b8e9-0221144f675b
📒 Files selected for processing: 1
au3/libraries/au3-wave-track/WaveTrackUtilities.cpp
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| ExpandClipTillNextOne(const WaveTrack& track, WaveTrack::Interval& interval); | ||
|
|
||
| //! Remove clips for which `WaveClip::IsEmpty()` is true | ||
| WAVE_TRACK_API void RemoveEmptyClips(WaveTrack& track); |
There was a problem hiding this comment.
Only used in the .cpp file. Is it needed in the API?
There was a problem hiding this comment.
We don't need any XXX_API in all libraries, since we link statically. I kept it for uniformity.
There was a problem hiding this comment.
I meant that the function is only used internally, in WaveTrackUtilities.cpp.
At this step, an attempt to open causes a crash :( |
|
The above-mentioned issue has nothing to do with this PR, it already exists on master |
Before the fix an empty clip (one sample long) was removed before creating a saved state, and its sample were removed from the sample block table, while the saved project document still referenced it Assisted-by: Claude Code (Claude Opus 5.5)
1153d81 to
de7fdae
Compare
Fix project corruption caused by removing empty clips on load
Resolves: project corruption when one sample clip is saved in the project
Before the fix an empty clip (one sample long) was removed before creating a saved state, and its sample were removed from the sample block table, while the saved project document still referenced it.
STR:
Recommended: