qt: don't abort or drop settings when dynamic settings are disabled #36180

pull jeanpablojp wants to merge 2 commits into bitcoin:master from jeanpablojp:bitcoin-qt-nosettings-guard changing 7 files +108 −27
  1. jeanpablojp commented at 2:10 AM on September 7, 2026: contributor

    ArgsManager::WriteSettingsFile throws when dynamic settings are disabled, and three call sites in NodeImpl call it without checking first. So bitcoin-qt -nosettings aborts on -resetguisettings, and on the legacy GUI settings migration when an old Qt setting is still present, which comes back on every start because the abort happens before the key is removed.

    The fourth call site in that file is the wallet path in ChainImpl, and #36176 guards it. These three are the options dialog, and I ran into them while testing that PR.

    The flag is easier to reach than it looks, since the fatal error box suggests -nosettings when the settings file cannot be written.

    Guarding the writes on its own is not enough, because three things then happen silently instead of aborting. The migration drops the legacy keys, since it removes them whether or not the write landed. The dialog closes reporting success, since setOption only reported parse errors and QDataWidgetMapper::submit() does not propagate what setData returns. And it asks for a restart that would discard the change rather than apply it, which is reachable today without the flag.

    bitcoin-qt -regtest -nosettings -resetguisettings aborts on master and starts here. The Qt tests cover the guards and each of those, with settings disabled and with a write that fails, and each one fails without its change.

    The second commit reports rather than fixes the abort, so it can be dropped if reviewers would rather keep this to the crash.

  2. node, qt: don't write settings.json when dynamic settings are disabled
    ArgsManager::WriteSettingsFile throws when dynamic settings are disabled
    with -nosettings, and three call sites in NodeImpl call it unguarded, so
    bitcoin-qt -nosettings aborts on -resetguisettings and on the legacy GUI
    settings migration. The migration case comes back on every start,
    because the abort happens before the legacy key is removed.
    
    Guard the writes, and skip the migration when there is nowhere to
    migrate to, so legacy Qt settings are left in place rather than silently
    dropped.
    cfd09ec295
  3. qt: report a settings write that did not reach disk
    OptionsModel::setOption only reported failure on a parse error, so a
    write that never landed closed the dialog with no sign of it, and
    QDataWidgetMapper::submit() does not propagate what setData returns, so
    reading its result would not have helped. setRestartRequired() was
    called the same way, so the user was also told to restart, and the
    restart would drop the in-memory change rather than apply it.
    
    Record a failed write on the model, warn once the dialog has submitted,
    and only ask for a restart when the writes succeeded.
    7ff7e9bbe5
  4. DrahtBot added the label GUI on Sep 7, 2026
  5. DrahtBot commented at 2:10 AM on September 7, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36180.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. fanquake requested review from hebasto on Sep 7, 2026

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-09-09 07:56 UTC