Settings: a focused number field is saved during quit, after shutdown has started, with no confirmation or error #1114

Open
opened 2026-11-10 22:52:35 +00:00 by jarolrod · 0 comments
jarolrod commented 2026-11-10 22:52:35 +00:00 (Migrated from github.com)

A Settings number field that still has keyboard focus when the app quits is saved during shutdown. The write is accepted after shutdown has started, so the page can show neither its restart notice nor an error.

To reproduce, with pruning already on at 10 GB ("prune": "9536" in settings.json):

  1. Open Settings → Storage. Block storage limit (GB) shows 10.
  2. Click the field, select the text and type 2. Do not press Return.
  3. Quit the app.

settings.json now has "prune": "1907". The next start logs Prune configured to target 1907 MiB and Settings shows 2. No restart notice or confirmation was shown at any point.

The same happens for Mempool size limit (MB) (300 to 50) and Database cache size (MiB), and for Script verification threads in an offscreen run. Clicking another Settings section before quitting does not change the result: the hidden field keeps focus and is saved at quit.

Controls:

  • With 2 typed, kill -9 leaves 9536 on disk. Nothing is written while the app is running.
  • Pressing Return after typing writes 1907 at once and shows the restart notice. That is the normal path.
  • Quitting without typing, or with text the field rejects, changes nothing.

QmlShutdownCoordinator::requestShutdown emits shutdownStarted before it runs its shutdown participants (shutdowncoordinator.cpp#L18-L30). The first handler disables every window's content item (bitcoin.cpp#L718-L724). Disabling removes focus, the field emits editingFinished, and the page assigns the value (StorageSettingsPage.qml#L93-L101). The options model refuses commands only once it is stopping (options_model.cpp#L286-L288), and that flag is set by a participant that runs after the handler.

Saving when a field loses focus is these fields' normal rule, and the project's tests rely on it. The gap is narrower:

  • A settings write is admitted after shutdown has started, when nothing can confirm it or report a failure.
  • An edit left in a hidden section stays pending until quit.

Whether quitting should save or discard a focused edit is a product decision. Either way it should be decided before shutdown starts.

For the storage limit, a lower number becomes Core's prune target at the next start. On a real chain that deletes block files; regtest is too small to show it, so that step is from Core's code.

Related: #961 moved settings writes off the GUI thread. Shutdown ordering is tracked under #917.

Reproduced on merged qt6 at eed1f426fcb6, macOS / Qt 6.9, isolated regtest, offscreen and native. Focus and typing went through the test bridge, whose synthesized click does not focus the field. Quit, File → Exit and window close were bridge emulations; RPC stop and SIGTERM were real and gave the same result. No physical click, typing or Cmd+Q was done.

A Settings number field that still has keyboard focus when the app quits is saved during shutdown. The write is accepted after shutdown has started, so the page can show neither its restart notice nor an error. To reproduce, with pruning already on at 10 GB (`"prune": "9536"` in `settings.json`): 1. Open **Settings → Storage**. **Block storage limit (GB)** shows 10. 2. Click the field, select the text and type `2`. Do not press Return. 3. Quit the app. `settings.json` now has `"prune": "1907"`. The next start logs `Prune configured to target 1907 MiB` and Settings shows 2. No restart notice or confirmation was shown at any point. The same happens for **Mempool size limit (MB)** (300 to 50) and **Database cache size (MiB)**, and for **Script verification threads** in an offscreen run. Clicking another Settings section before quitting does not change the result: the hidden field keeps focus and is saved at quit. Controls: - With `2` typed, `kill -9` leaves 9536 on disk. Nothing is written while the app is running. - Pressing Return after typing writes 1907 at once and shows the restart notice. That is the normal path. - Quitting without typing, or with text the field rejects, changes nothing. `QmlShutdownCoordinator::requestShutdown` emits `shutdownStarted` before it runs its shutdown participants ([shutdowncoordinator.cpp#L18-L30](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/shutdowncoordinator.cpp#L18-L30)). The first handler disables every window's content item ([bitcoin.cpp#L718-L724](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/bitcoin.cpp#L718-L724)). Disabling removes focus, the field emits `editingFinished`, and the page assigns the value ([StorageSettingsPage.qml#L93-L101](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/settings/StorageSettingsPage.qml#L93-L101)). The options model refuses commands only once it is stopping ([options_model.cpp#L286-L288](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/models/options_model.cpp#L286-L288)), and that flag is set by a participant that runs after the handler. Saving when a field loses focus is these fields' normal rule, and the project's tests rely on it. The gap is narrower: - A settings write is admitted after shutdown has started, when nothing can confirm it or report a failure. - An edit left in a hidden section stays pending until quit. Whether quitting should save or discard a focused edit is a product decision. Either way it should be decided before shutdown starts. For the storage limit, a lower number becomes Core's prune target at the next start. On a real chain that deletes block files; regtest is too small to show it, so that step is from Core's code. Related: #961 moved settings writes off the GUI thread. Shutdown ordering is tracked under #917. Reproduced on merged `qt6` at `eed1f426fcb6`, macOS / Qt 6.9, isolated regtest, offscreen and native. Focus and typing went through the test bridge, whose synthesized click does not focus the field. Quit, **File → Exit** and window close were bridge emulations; RPC `stop` and SIGTERM were real and gave the same result. No physical click, typing or Cmd+Q was done.
Sign in to join this conversation.
No description provided.