Skip to content

Fix project corruption on save error - #12296

Merged
kryksyh merged 1 commit into
audacity:masterfrom
kryksyh:fix_project_corruption_on_save_error
Sep 25, 2026
Merged

kryksyh merged 1 commit into
audacity:masterfrom
kryksyh:fix_project_corruption_on_save_error

Conversation

@kryksyh

@kryksyh kryksyh commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Resolves: Unsuccessful save was updating internal state, which resulted in data loss on project close

  • I signed CLA
  • This PR includes AI assistance
  • If the PR is AI-assisted, I have read, understood and complied with the guidelines for AI-assisted contributions
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

Unsuccessful save was updating internal state, which resulted in data loss on project close
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

During project load, the saved-state snapshot is now updated before the code removes overlapping clip play regions. During project save, the snapshot is updated only when SaveProject succeeds.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🔵 Low · up to da2f7

A failed save can still leave unsaved master effects eligible for serialization when the project closes. This is a bounded failure-path risk to address or accept before merging.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: preventing project corruption caused by an unsuccessful save.
Description check ✅ Passed The description states the issue and motivation and includes the required checklist. It omits a direct issue link and leaves the recommended build-and-run item unchecked, but the description is otherw…

Warning

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Preserve the master-effect snapshot when SaveProject fails. · au3project.cpp:205

src/au3wrap/internal/au3project.cpp:205
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Preserve the master-effect snapshot when SaveProject fails.

save() updates SavedMasterEffectList before ProjectFileIO::SaveProject. If the save fails, the updated copy remains in memory. The close path can then serialize that copy through Compact or UpdateSaved, causing unsaved master effects to be written. Restore the previous copy on failure, or serialize from a separate copy without changing the saved snapshot.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 2661a176-35d0-430c-a52d-10fb9963ddc9

📥 Commits

Reviewing files that changed from the base of the PR and between f869383 and da2f702.

📒 Files selected for processing (1)
  • src/au3wrap/internal/au3project.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@kryksyh
kryksyh merged commit c6c850f into audacity:master Sep 25, 2026
28 checks passed
@kryksyh
kryksyh deleted the fix_project_corruption_on_save_error branch September 25, 2026 12:15
@kryksyh kryksyh added this to the Audacity 4.0.1 milestone Sep 25, 2026
@kryksyh kryksyh self-assigned this Sep 25, 2026
kryksyh added a commit that referenced this pull request Sep 25, 2026
Fix project corruption on save error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants