Skip to content

qt: Fix crash in block view during IBD #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 28.x-knots
Choose a base branch
from

Conversation

rebroad
Copy link

@rebroad rebroad commented Apr 16, 2025

Fixes a crash that occurs when the block view window is open during initial block download (IBD). The crash happens due to a memory alignment issue in Qt's string handling when updating the block height from a non-main thread.

The issue occurs in GuiBlockView::updateBestBlock where string formatting is performed on the b-scheduler thread instead of the main GUI thread. This is unsafe as Qt's string handling and GUI operations must be performed on the main thread.

The fix uses QMetaObject::invokeMethod with Qt::QueuedConnection to ensure the string formatting and GUI update happens on the main thread, preventing the memory alignment issue.

This is a follow-up to commit d69357d and fixes issue #105

Tested by:

  • Opening block view during IBD
  • Verifying block height updates work correctly
  • Confirming no crashes occur during IBD

Fixes a crash that occurs when the block view window is open during initial block download (IBD). The crash happens due to a memory alignment issue in Qt's string handling when updating the block height from a non-main thread.

The issue occurs in `GuiBlockView::updateBestBlock` where string formatting is performed on the b-scheduler thread instead of the main GUI thread. This is unsafe as Qt's string handling and GUI operations must be performed on the main thread.

The fix uses `QMetaObject::invokeMethod` with `Qt::QueuedConnection` to ensure the string formatting and GUI update happens on the main thread, preventing the memory alignment issue.

This is a follow-up to commit d69357d and fixes issue bitcoin#105

Tested by:
- Opening block view during IBD
- Verifying block height updates work correctly
- Confirming no crashes occur during IBD
@luke-jr luke-jr added the bug label May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants