Skip to content

Fix startup crash when reloading extensions from a global-context provider - #342

Closed
luapmartin wants to merge 1 commit into
musescore:mainfrom
luapmartin:luapmartin/extensions-reload-global-ctx
Closed

luapmartin wants to merge 1 commit into
musescore:mainfrom
luapmartin:luapmartin/extensions-reload-global-ctx

Conversation

@luapmartin

@luapmartin luapmartin commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Resolves: N/A — fixes the startup crash in audacity/audacity#12403 (all testflow cases)

  • I signed the CLA.
  • The title of the PR describes the problem it addresses.
  • Each commit's message describes its purpose and effects, and references the issue it resolves. If changes are extensive, there is a sequence of easily reviewable commits.
  • The code in the PR follows the coding rules.
  • The code compiles and runs on my machine, preferably after each commit individually. I have manually tested and verified that my changes fulfil their intended purpose.
  • No prior attempts to resolve this problem exist, or if they do, I listed them in my PR description and described how I avoided repeating past mistakes.
  • There are no unnecessary changes.

Complete only if applicable:

  • I created a unit test or vtest to verify the changes I made.
  • This PR was created using AI assistance; I have read, understood and complied following the guidelines for AI-assisted contributions. The AI tool(s) I used are listed below.

Build configuration

audacity: audacity/audacity/master
audacity platforms: linux_x64
musescore: musescore/MuseScore/main
musescore platforms: linux_x64

@luapmartin luapmartin self-assigned this Oct 7, 2026
const modularity::ContextPtr& ctx = iocContext();
if (ctx && ctx->id > 0) {
extensionsUiEngine()->clearComponentCache();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this way is better, it's clearer

if (extensionsUiEngine) {
     extensionsUiEngine()->clearComponentCache();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there's no bool operator on InjectBase and if we want to use the call form then we gonna hit the asserts on ctx->id > 0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, yes, you're right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But something isn't right here :)
ExtensionsProvider itself is also contextual.
How does it happen that it gets created, yet extensionsUiEngine doesn't?

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: musescore/muse_framework/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 37db28e9-2eb6-494a-bfcf-b5c61a123d45
📥 Commits

Reviewing files that changed from the base of the PR and between b1f5a4b and b200700.

📒 Files selected for processing (1)
  • framework/extensions/internal/extensionsprovider.cpp

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

reloadExtensions() clears the component cache only when the IoC context is non-null and has an ID greater than zero. The extension registry reload remains unconditional.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to b2007

Only after an unusually large number of context creations can an extension reload retain stale plugin QML. This is a bounded, low-likelihood risk; merging with owner awareness is reasonable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 identifies the startup crash and the global-context provider involved.
Description check ✅ Passed The description explains the crash, references the Audacity issue, completes the main checklist, and includes build configuration. The AI-assistance checkbox is marked, but the AI tool name is not lis…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@luapmartin
luapmartin force-pushed the luapmartin/extensions-reload-global-ctx branch from b200700 to 60da87b Compare October 7, 2026 10:44
@luapmartin

Copy link
Copy Markdown
Contributor Author

Closing: as discussed, the provider must not be created with the global context in the first place — Audacity's ExtensionEffectsModule did that as a workaround and will use the global IExtensionsRegister instead (going into audacity/audacity#12403). No framework change needed.

@luapmartin luapmartin closed this Oct 7, 2026
@luapmartin
luapmartin deleted the luapmartin/extensions-reload-global-ctx branch October 7, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants