Fix double invocation of App._stop when using App.stop and App.run #8736
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.
Fixes #2397 and #4577
Previosly
on_stop
- or App._stop
in general - would be triggered twice if anApp
instance was used in combination withApp.run
andApp.stop
. This was due toApp.run
invokingApp._stop
on its own as well.My proposed fix keeps this behaviour as is but changes
App.stop
to not callApp._stop
directly but instead usestopTouchApp
orEventLoop.close
to have thenApp.run
invokeApp._stop
This should not cause any issues since
App._stop
is only ever invoked byApp.run
,App.async_run
and previouslyApp.stop
as far as I am aware and runningApp.run
still yield in the same results even ifApp.stop
is never called by the user. The only change in behaviour would be usingApp.stop
without ever callingApp.run
which shouldn't ever be the case anyways.This also voids the second
stopTouchApp
call inApp._stop
MRE
Maintainer merge checklist
Component: xxx
label.api-deprecation
orapi-break
label.release-highlight
label to be highlighted in release notes.versionadded
,versionchanged
as needed.