Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Drop upgrade-cancel callback registration for a generic "cancelable" #10770
Conversation
TheBlueMatt
referenced
this pull request
Jul 7, 2017
Merged
Allow to cancel the txdb upgrade via splashscreen keypress 'q' #10660
| + (cancel_possible ? (std::string("\n") + _("(press q to shutdown and continue later)")) | ||
| + : std::string(""))); | ||
| + | ||
| + if (cancel_possible) { |
ryanofsky
Jul 7, 2017
•
Contributor
Don't you need to invoke setBreakAction(nullptr) here when cancel_possible is false?
Maybe better would be to get rid of this std::function madness and replace the SplashScreen::breakAction pointer with a simpler boolean std::atomic<bool> m_cancel_possible which you can just assign directly.
fanquake
added the
GUI
label
Jul 7, 2017
|
Makes sense. I guess I over-engineered the flexible callback (I thought we should have a way to not only shutdown and have the future option to "continue" but this really makes little sense). utACK 1d62f6e |
| @@ -36,8 +36,8 @@ public Q_SLOTS: | ||
| /** Show message and progress */ | ||
| void showMessage(const QString &message, int alignment, const QColor &color); | ||
| - /** Sets the break action */ | ||
| - void setBreakAction(const std::function<void(void)> &action); | ||
| + /** Sets if cancel is currently possible */ |
ryanofsky
Jul 10, 2017
Contributor
I'd consider replacing "cancel possible" with "shutdown possible" everywhere in this PR. The function this is controlling is called StartShutdown. The display text is press q to shutdown. Why should this thing be named differently?
TheBlueMatt
Jul 10, 2017
Contributor
"shutdown" is always possible (just may be slow), what you care about is cancelling the currnent "in progress" thing (and shutting down). I dont really care, but also dont think its particularly unclear?
ryanofsky
Jul 10, 2017
Contributor
I dont really care, but also dont think its particularly unclear?
It's unclear to me what the flag is supposed to indicate or why it wouldn't always be true if shutdown is always possible. Maybe it should be called fast_shutdown_possible if that's what it actually means. Acked this because the PR is definitely a simplification, but I don't think the code or the reason for preventing the quit option from working after the upgrade is clear. I think better naming could help.
TheBlueMatt
Jul 11, 2017
Contributor
Added some additional comments. I'm not really sure if thats a better name, though I agree cancel_possible is a bit strange.
|
This begs the question whether we shouldn't just have 'q for shutdown' always available? Maybe in some cases there is some initializationstep-specific cleanup, but there shouldn't be much as we're always allowed to crash anyway. |
|
@sipa yea, I thought about that. We should maybe move the boolean to just change the message to "will complete later if you shutdown now". I still think this is a nice cleanup, and given we're already in freeze for 0.15 it'd be too late to make that change for 0.15. If this sits for the next month without any movement I'll make that change for 16. |
|
Tested. Segfaults when cancelling during upgrade:
|
|
@sipa hmm, I could be wrong but that strikes me as an issue that would also be present prior to the changes in this PR. |
TheBlueMatt
referenced
this pull request
Jul 16, 2017
Open
Fix some chainstate-init-order bugs. #10758
jj1010
commented
Jul 16, 2017
|
Como faço para criar minha própria moeda virtual
Em sábado, 15 de julho de 2017, Matt Corallo <notifications@github.com>
escreveu:
…
|
| { | ||
| - breakAction = action; | ||
| -} | ||
| + InitMessage(splash, title + strprintf("%d", nProgress) + "%" + |
TheBlueMatt
added some commits
Jul 7, 2017
ryanofsky
reviewed
Jul 25, 2017
utACK 59147fa. Only change since last review is rearranged progress string.
TheBlueMatt commentedJul 7, 2017
Instead of passing a StartShutdown reference all the way up from
txdb, give ShowProgress a "cancelable" boolean, as StartShutdown
is pretty much always what you'll want to use to cancel. Use the
same boolean to allow cancel during initial block verification.