Skip to content

Conversation

@UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Mar 1, 2025

Issue being fixed or feature implemented

Original PR description:

SplashScreen::deleteLater() does not guarantee deletion of the m_splash object prior to the wallet context deletion. If the latter happens first, the segfault follows.

Crash:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
...
6   libc++abi.dylib               	       0x19012d6b4 std::terminate() + 108
7   dash-qt                       	       0x1027e5744 SplashScreen::~SplashScreen() + 504 (splashscreen.cpp:142)
8   dash-qt                       	       0x1027e5974 SplashScreen::~SplashScreen() + 4 (splashscreen.cpp:141) [inlined]
9   dash-qt                       	       0x1027e5974 SplashScreen::~SplashScreen() + 36 (splashscreen.cpp:141)
...

The issue was introduced via bitcoin#19101 backport (14aa05d) in #6529.

What was done?

Backport bitcoin-core/gui#605

How Has This Been Tested?

Run ./src/qt/dash-qt --regtest and press q while on splash screen to shutdown asap

develop: crash
this PR: no crash

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

1b22849 qt: Drop no longer used `SplashScreen::finish()` slot (Hennadii Stepanov)
10811af qt: Drop no longer used `BitcoinApplication::splashFinished()` signal (Hennadii Stepanov)
5299cfe qt: Delete splash screen widget explicitly (Hennadii Stepanov)

Pull request description:

  Fixes bitcoin-core/gui#604.
  Fixes bitcoin#25146.
  Fixes bitcoin#26340.

  `SplashScreen::deleteLater()` [does not guarantee](https://doc.qt.io/qt-5/qobject.html#deleteLater) deletion of the `m_splash` object prior to the wallet context deletion. If the latter happens first, the [segfault](bitcoin-core/gui#604 (comment)) follows.

ACKs for top commit:
  dooglus:
    ACK bitcoin-core/gui@1b22849
  furszy:
    ACK 1b22849
  john-moffett:
    ACK 1b22849

Tree-SHA512: bb01d0bf2051f5b184dc415c4f5d32dfb7b8bd772feff7ec7754ded4c6482de27f004b9712df7d53c5ee82e153f48aef4372e4a49d7bcbbb137f73e9b4947962
@UdjinM6 UdjinM6 added this to the 23 milestone Mar 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Mar 1, 2025

Walkthrough

The pull request refactors the management of the splash screen within the application's Qt interface. Instead of relying on signal-slot connections for automatic deletion, the code now explicitly deletes the splash screen in both the shutdown and initialization routines. The BitcoinApplication class now removes the previously declared splashFinished() slot, and the explicit connection to the splash screen’s finish actions has been eliminated. Additionally, the finish() method in the SplashScreen class has been removed from both its implementation and header file. These modifications centralize the lifecycle management of the splash screen by shifting responsibility from automatic signal-driven deletion to direct deletion calls, thereby simplifying the overall code responsible for the splash screen's lifecycle.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26ea618 and 17b40f9.

📒 Files selected for processing (4)
  • src/qt/bitcoin.cpp (2 hunks)
  • src/qt/bitcoin.h (0 hunks)
  • src/qt/splashscreen.cpp (0 hunks)
  • src/qt/splashscreen.h (0 hunks)
💤 Files with no reviewable changes (3)
  • src/qt/splashscreen.cpp
  • src/qt/bitcoin.h
  • src/qt/splashscreen.h
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
🔇 Additional comments (2)
src/qt/bitcoin.cpp (2)

327-329: Good fix to prevent segfault during shutdown.

Explicitly deleting the splash screen early in the shutdown process is the right approach. This ensures the splash screen is properly cleaned up before the wallet context is deleted, preventing the potential segmentation fault mentioned in the PR objectives.


373-375: Good approach for handling splash screen cleanup after initialization.

Explicitly deleting the splash screen after successful initialization provides consistent behavior with the shutdown path. This change further ensures that the splash screen object won't persist longer than needed, reducing the chances of crashes if the wallet context is deleted first.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@UdjinM6 UdjinM6 requested review from PastaPastaPasta and knst March 4, 2025 17:07
Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

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

utACK 17b40f9

@PastaPastaPasta PastaPastaPasta merged commit bb48fea into dashpay:develop Mar 18, 2025
27 of 29 checks passed
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.

4 participants