Skip to content

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
@luke-jr
Copy link
Collaborator

luke-jr commented Aug 23, 2025

I believe this is fixed already in the upcoming Knots 29, please confirm (branch tmp is staging)

@Ataraxia009
Copy link

Tested this on latest, it seems fixed. @rebroad please verify and close

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.

3 participants