-
Notifications
You must be signed in to change notification settings - Fork 36.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gui: Defer removeAndDeleteWallet when no modal widget is active #15614
gui: Defer removeAndDeleteWallet when no modal widget is active #15614
Conversation
Alternative to #15313 for 0.18, more details in http://www.erisian.com.au/bitcoin-core-dev/log-2019-03-16.html (line 279) cc @gmaxwell @jonasschnelli |
Concept ACK for 0.18. Looks like a hack (but a good one)... I think we should merge this into 0.18 and properly remove synchronous dialogs in 0.19. |
Hmm... second thought: I'm unsure about this. This waits until the users closes the dialogs (rather then closing them explicit). This may lead to an RPC timeout in Maybe we combine this with #15313? |
I don't think that's a problem. The RPC client can timeout (can also happen for other reasons, rescanning for instance?) but the RPC handler still waits. This fixes a unlikely crash (I mean, is there a good reason to do this?) without major changes and can be reverted easily if the future master refactor is backport. |
I'll verify if |
Changed base, needs commit cherry-picked on some other base as well, obviously. |
ae59821
to
f33e9bc
Compare
Rebased. |
Should update OP with something like "Addresses #15310"? |
This seems like a better workaround to the issue for the short term. |
@MarcoFalke yes, after rebased with master. |
tested ACK f33e9bc (No longer crashes and having the modal gui dialog open will block the unloadwallet RPC, didn't review code too closely) |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
src/qt/walletcontroller.cpp
Outdated
removeAndDeleteWallet(wallet_model); | ||
// Defer removeAndDeleteWallet when no modal widget is active. | ||
if (QApplication::activeModalWidget()) { | ||
connect(qApp, &QApplication::focusChanged, wallet_model, [this, wallet_model]() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that the 3rd parameter wallet_model
is used as the destination context, which means:
- the connection is destroyed when the
wallet_model
is destroyed - the connection runs on the wallet model thread (GUI thread) due to
Qt::QueuedConnection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect there's some race conditions here, but strict improvement over the current condition, so utACK
@luke-jr care to elaborate? |
030a0f0
to
a10972b
Compare
Tested ACK a10972b |
…et when no modal widget is active 98a24a2 gui: Defer removeAndDeleteWallet when no modal widget is active (João Barbosa) Pull request description: 0.18 Backport of #15614 Tree-SHA512: 8f785705325364ecfa37045090f10ca615f457e279789b0ce0d61f2667f491bce9b44f5e5cdeeecf63d61356213d9a97a3578841295cc8480cf42e037c2decb2
line 104 evaluates to false, then a problematic modal window is opened before line 111 or line 104 evaluates to true, then the problematic modal window is closed before focusWindowChanged is connected; wallet closing then waits for some arbitrarily future time |
@luke-jr it's impossible, both callbacks runs in the GUI thread and so:
|
I thought the whole point of the Qt::QueuedConnection was to move the callback to the GUI thread later? |
Ah, nevermind, I get it - the focusWindowChanged might be in another thread. |
…idget is active a10972b gui: Defer removeAndDeleteWallet when no modal widget is active (João Barbosa) Pull request description: Fixes bitcoin#15310. Tree-SHA512: ac91a4e37020d3a854830c50c0a7a45c2c0537f80be492ec5e9ba7daf90725e912f9dcc324605493599c36180e1d3bcdfa86840b7325cba208b7e93fbe7be368
…idget is active a10972b gui: Defer removeAndDeleteWallet when no modal widget is active (João Barbosa) Pull request description: Fixes bitcoin#15310. Tree-SHA512: ac91a4e37020d3a854830c50c0a7a45c2c0537f80be492ec5e9ba7daf90725e912f9dcc324605493599c36180e1d3bcdfa86840b7325cba208b7e93fbe7be368
…idget is active a10972b gui: Defer removeAndDeleteWallet when no modal widget is active (João Barbosa) Pull request description: Fixes bitcoin#15310. Tree-SHA512: ac91a4e37020d3a854830c50c0a7a45c2c0537f80be492ec5e9ba7daf90725e912f9dcc324605493599c36180e1d3bcdfa86840b7325cba208b7e93fbe7be368
Fixes #15310.