gui: remove assert in walletcontroller & run setparent in gui-qt main thread #18961

pull tarboss wants to merge 2 commits into bitcoin:master from tarboss:master changing 2 files +19 −5
  1. tarboss commented at 4:41 PM on May 12, 2020: none

    small fix, u should use setparent() call in qt only if u own the object (thread created the object).

  2. remove assert in walletcontroller & run setparent in gui-qt main thread 970e2ffa64
  3. MarcoFalke renamed this:
    remove assert in walletcontroller & run setparent in gui-qt main thread
    gui: remove assert in walletcontroller & run setparent in gui-qt main thread
    on May 12, 2020
  4. DrahtBot added the label GUI on May 12, 2020
  5. DrahtBot commented at 10:02 PM on May 12, 2020: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18948 (qt: Do not call setParent() for WalletModel instances by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  6. in src/qt/walletcontroller.cpp:143 in 970e2ffa64 outdated
     140 | +    if (QThread::currentThread() == thread()) {
     141 | +        addWallet(wallet_model);
     142 | +    } else {
     143 | +        // Handler callback runs in a different thread so fix wallet model thread affinity.
     144 | +        wallet_model->moveToThread(thread());
     145 | +        bool invoked = QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, Q_ARG(WalletModel*, wallet_model));
    


    promag commented at 11:27 PM on May 12, 2020:

    I was going to suggest to use Qt::BlockingQueuedConnection instead, so that the caller gets the wallet model with the parent already set.


    tarboss commented at 7:52 PM on May 13, 2020:

    i think - it stucks on windows if u do Blocking. Need to check more, but not today.

  7. in src/qt/walletcontroller.cpp:111 in 970e2ffa64 outdated
     107 | @@ -108,9 +108,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
     108 |  
     109 |      // Instantiate model and register it.
     110 |      WalletModel* wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style, nullptr);
     111 | -    // Handler callback runs in a different thread so fix wallet model thread affinity.
     112 | -    wallet_model->moveToThread(thread());
     113 | -    wallet_model->setParent(this);
     114 | +
    


    promag commented at 11:28 PM on May 12, 2020:

    nit, remove (IMO).

  8. in src/qt/walletcontroller.cpp:151 in 970e2ffa64 outdated
     148 |      return wallet_model;
     149 |  }
     150 |  
     151 | +void WalletController::addWallet(WalletModel* wallet_model)
     152 | +{
     153 | +    // Take ownership of the wallet model and register it.
    


    promag commented at 11:32 PM on May 12, 2020:

    s/register/notify?


    tarboss commented at 6:03 AM on May 13, 2020:

    comment must be updated,too (setparent & emit to update gui), ownership already done in if-clause and register was in m_wallets.push_back(wallet_model) - if u change more in walletcontroller.cpp, u should change it.

  9. Merge remote-tracking branch 'upstream/master' 6dc30947fc
  10. tarboss closed this on May 15, 2020

  11. DrahtBot locked this on Feb 15, 2022
Labels

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-13 21:14 UTC

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