Fix uninitialized platformStyle member in AddressBookPage#1815
Fix uninitialized platformStyle member in AddressBookPage#1815reubenyap wants to merge 2 commits intofiroorg:masterfrom
Conversation
…-name tabs In AddressBookPage::selectionChanged, the delete button was unconditionally re-enabled on the Sending tab even when the current address type is a spark name, leaving it enabled=true but visible=false. chooseAddressType sets enabled=false when switching to a spark-name tab, but the next row-click on that tab flipped it back. Harmless today (hidden buttons can't be clicked), but the state is inconsistent with deleteAction and the button's visibility, and would trip up a future refactor that stops hiding the button. Gate setEnabled on fSparkNames so the three flags move together.
The AddressBookPage constructor accepted a platformStyle parameter that shadowed the member of the same name, so the member was never initialized. Reading it later (e.g. in on_newAddress_clicked when constructing CreateSparkNamePage) was undefined behavior. Add the member to the initializer list so it holds the passed-in pointer.
|
CodeAnt AI is reviewing your PR. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbitRelease Notes
WalkthroughThe AddressBookPage constructor now properly initializes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
CodeAnt AI finished reviewing your PR. |
User description
Summary
The
AddressBookPageconstructor insrc/qt/addressbookpage.cppaccepts aconst PlatformStyle *platformStyleparameter that shadows the class member of the same name declared atsrc/qt/addressbookpage.h:66. The constructor body uses the parameter for icon setup but never assigns it to the member, sothis->platformStyleremained uninitialized (indeterminate pointer value).The uninitialized member is later read in
on_newAddress_clickedwhen constructingCreateSparkNamePage(platformStyle, this). Reading an uninitialized pointer is undefined behavior. Today it happens not to crash becauseCreateSparkNamePage's constructor ignores the parameter, but any future change that actually uses it would expose the bug.Fix: add
platformStyle(platformStyle)to the constructor initializer list. One-line change, matching the pattern already used insrc/qt/manualmintdialog.cpp.Test plan
firo-qtand confirm it compiles without new warningson_newAddress_clicked; verify the Spark name dialog path still worksCodeAnt-AI Description
Fix address book button state and Spark name dialog setup
What Changed
Impact
✅ Fewer confusing delete-button states✅ Safer Spark name dialog opening✅ Lower risk of address book crashes🔄 Retrigger CodeAnt AI Review
Details
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.