Fix nasty and still unclear bug with "Close Other" not closing all ta… #725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In certain conditions, not clear which, when clicking on "Close Others", not all tabs are closed as expected, but one or two tabs are left open.
As said, it's not clear the origin of this bug. But we can consistently trigger it in our application.
Likely, the issue is a race condition between the Q_EMIT on requesting the close of the tab, and the subsequent isClosed test in the code handling the command.
Fortunately, there's a easy and elegant solution, that is, instead of fixing the tab index based on the close state of the being-closed tab, we can count backward and ignore wheather the tab was closed or not. This totally avoid the async problem with the user request.
This fixes the issue on our application and still works on the demo app.