Repository navigation
fix(rgbww): own profile copy in singleton (meta #2580 A4) - #2588
Conversation
set_rgbww_colorimetric_profile() previously stored the caller's raw pointer in singleton state. Passing a stack-local RgbcctProfile turned this into a use-after-scope on the next get_rgbww_colorimetric_profile() call. Store an owned copy instead; nullptr still reverts to the default profile. Public API signature is unchanged. Addresses CodeRabbit finding A4 from meta #2580 (originally from #2560).
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR eliminates a dangling pointer risk in the singleton colorimetric profile state. ChangesColorimetric Profile Ownership
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Summary
set_rgbww_colorimetric_profile(const RgbcctProfile* profile)stored the caller's raw pointer in a singleton. Passing a stack-localRgbcctProfile(the natural usage fromsetup()) became a use-after-scope on the nextget_rgbww_colorimetric_profile()call.This PR changes the singleton storage to keep an owned copy of the profile (with a
has_profileflag).nullptrstill reverts tokRgbwwDefaultProfile. The public API signature is unchanged, so no callers break.Addresses meta-issue #2580 finding A4 (originally CodeRabbit on #2560 — #2560 (comment)).
Test plan
bash lintSummary by CodeRabbit