gui: only call getOrCreateWallet if wallet interface pointer not null #16955

pull icota wants to merge 1 commits into bitcoin:master from icota:qt-loadwallet-crash changing 1 files +1 −1
  1. icota commented at 2:47 PM on September 24, 2019: contributor

    Avoid early call to loadwallet crashing bitcoin-qt. Meant to fix #16937.

  2. gui: only call getOrCreateWallet if wallet interface pointer not null
    Avoids early call to loadwallet crashing bitcoin-qt (https://github.com/bitcoin/bitcoin/issues/16937)
    db31bcb475
  3. in src/qt/walletcontroller.cpp:34 in db31bcb475
      30 | @@ -31,7 +31,7 @@ WalletController::WalletController(interfaces::Node& node, const PlatformStyle*
      31 |      , m_options_model(options_model)
      32 |  {
      33 |      m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) {
      34 | -        getOrCreateWallet(std::move(wallet));
      35 | +        if (wallet) getOrCreateWallet(std::move(wallet));
    


    promag commented at 2:58 PM on September 24, 2019:

    In what case wallet is null?


    emilengler commented at 7:48 PM on September 24, 2019:

    See line 95 in qt/walletcontroller.cpp There it checks if the wallet is empty even though it isn't null (I think).


    icota commented at 8:18 AM on September 25, 2019:

    @promag In case you call loadwallet very early in bitcoin-qt init. @fanquake has written a python script in #16937 that triggers it consistently.


    promag commented at 9:31 AM on September 25, 2019:

    This fix is incorrect.


    icota commented at 12:12 PM on September 25, 2019:

    Okay. Care to elaborate?


    promag commented at 12:19 PM on September 25, 2019:

    Sorry, forgot to update this, see #16963.

    Note that conceptually you are being notified about a new wallet, it should exist! Also this change hides a more severe problem which is explained in my PR.


    icota commented at 1:47 PM on September 25, 2019:

    Thanks, closing this now in favour of #16963.

  4. DrahtBot added the label GUI on Sep 24, 2019
  5. icota closed this on Sep 25, 2019

  6. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 21:14 UTC

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