Fix wallet list hover crash on shutdown #765

pull furszy wants to merge 2 commits into bitcoin-core:master from furszy:2023_gui_fix_crash_wallet_list changing 1 files +10 −7
  1. furszy commented at 1:51 pm on October 6, 2023: member

    Small follow-up to #751.

    Fixes another crash cause during shutdown. Which occurs when the user hovers over the wallets list.

    Future Note: This surely happen in other places as well, we should re-work the way we connect signals. Register lambas without any precaution can leave dangling pointers.

  2. DrahtBot commented at 1:51 pm on October 6, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK hebasto

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. hebasto renamed this:
    gui: fix wallet list hover crash on shutdown
    Fix wallet list hover crash on shutdown
    on Oct 6, 2023
  4. hebasto added this to the milestone 26.0 on Oct 7, 2023
  5. hebasto commented at 12:29 pm on October 7, 2023: member

    Future Note: This surely happen in other places as well, we should re-work the way we connect signals. Register lambas without any precaution can leave dangling pointers.

    Wouldn’t be enough to use an QObject::connect overload with the additional context parameter, i.e.

    0QObject::connect(const QObject* sender, PointerToMemberFunction signal, const QObject* context, Functor functor, Qt::ConnectionType type)
    

    instead of

    0QObject::connect(const QObject* sender, PointerToMemberFunction signal, Functor functor)
    

    The former assumes that:

    The connection will automatically disconnect if the sender or the context is destroyed. However, you should take care that any objects used within the functor are still alive when the signal is emitted.

    Also see a discussion in #680.

  6. furszy force-pushed on Oct 13, 2023
  7. gui: provide wallet controller context to wallet actions
    Addressing potential crashes during shutdown. The most
    noticeable one can be triggered by hovering over the
    wallet list as the app shuts down.
    7066e8996d
  8. gui: disable top bar menu actions during shutdown
    Opening the top bar menu when the app is being destroyed
    freezes the GUI shutdown process for no reason. No menu
    action can be executed.
    
    Note:
    This behavior is consistent with how the tray icon menu
    is cleared too.
    8b6470a906
  9. furszy force-pushed on Oct 13, 2023
  10. furszy commented at 8:52 pm on October 13, 2023: member

    Future Note: This surely happen in other places as well, we should re-work the way we connect signals. Register lambas without any precaution can leave dangling pointers.

    Wouldn’t be enough to use an QObject::connect overload with the additional context parameter, i.e.

    0QObject::connect(const QObject* sender, PointerToMemberFunction signal, const QObject* context, Functor functor, Qt::ConnectionType type)
    

    instead of

    0QObject::connect(const QObject* sender, PointerToMemberFunction signal, Functor functor)
    

    The former assumes that:

    The connection will automatically disconnect if the sender or the context is destroyed. However, you should take care that any objects used within the functor are still alive when the signal is emitted.

    Also see a discussion in #680.

    Tackled. Thanks. I was a bit doubtful initially because we are manually deleting the wallet_controller field instead of letting QT do it for us.. but, thanks to the QObject::destroyed signal, this works fine.

    Other than that, while testing the changes, I saw that the GUI shutdown process was being frozen when the user hovers over the non-triggerable top bar menu actions. So, the second commit also fixes this by clearing the menu (same as we do with the tray icon menu).

  11. DrahtBot added the label CI failed on Oct 14, 2023
  12. DrahtBot removed the label CI failed on Oct 14, 2023
  13. in src/qt/bitcoingui.cpp:655 in 8b6470a906
    649@@ -650,7 +650,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
    650 
    651         m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
    652     } else {
    653-        if(trayIconMenu)
    654+        // Shutdown requested, disable menus
    655+        if (trayIconMenu)
    656         {
    


    hebasto commented at 10:57 am on October 16, 2023:

    style nit:

    0        if (trayIconMenu) {
    
  14. hebasto approved
  15. hebasto commented at 10:58 am on October 16, 2023: member
    ACK 8b6470a90652fcffc45b8d7998af7c8ad6251332, I’ve tested each commit separately on macOS Sonoma 14.0 (Apple M1).
  16. hebasto merged this on Oct 16, 2023
  17. hebasto closed this on Oct 16, 2023

  18. furszy deleted the branch on Oct 16, 2023
  19. Frank-GER referenced this in commit ce4a6ec344 on Oct 21, 2023
  20. hebasto commented at 11:21 am on October 23, 2023: member
    Unfortunately, it introduced a regression. See #770.
  21. hebasto referenced this in commit 565c55119b on Oct 23, 2023
  22. bitcoin-core locked this on Oct 22, 2024


furszy DrahtBot hebasto

Milestone
26.0


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 07:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me