refactor the exit of nvda and gui.terminate#12286
Conversation
See test results for failed build of commit 91d0012f0d |
See test results for failed build of commit 074e5b2a59 |
|
Can you also test:
|
|
@feerrenrut - these test cases work (as in the correct version of NVDA runs) but NVDA won't exit safely, I've noted this in the Known issues with this PR section. |
|
will this backwards compatibility for upgrading/downgrading need to stay forever? I've marked it for 2022.1 deprecation but it would still be an issue when upgrading from 2020.4 |
That's fine. I don't think there is any way around that.
I think it should stay for a long time. I wouldn't remove it for 2022.1. |
How should I mark the code? Or should the deprecation notes be removed entirely?
Correct, how does the new message look? |
|
Is quitting a newer copy of NVDA by version <= 2020.4 (with WM_QUIT) any worse now than it used to be? Granted it probably never entirely worked, but has the movement of code now caused less things to be cleaned up? |
Co-authored-by: Reef Turner <feerrenrut@users.noreply.github.com>
See test results for failed build of commit 982119d5ed |
No, as |
See test results for failed build of commit 89fe6664e5 |
See test results for failed build of commit 89fe6664e5 |
|
In safeAppExit: I think we should replace all x.Destroy() and wx.CallAfter(x.Destroy) calls with app.ScheduleForDestruction(x). |
|
@michaelDCurran - I've incorporated that change and retested. I noticed that the WM_QUIT signal was not being sent properly (based off my misunderstanding of how WM_QUIT worked from earlier). This should be fixed now. |
|
The print calls in nvda.pyw (which happen when upgrading from an older snapshot build, or any older release) are causing a wx error dialog to appear in binary builds. This is confusing, but is also seeming to freeze up the Windows shell, or at very least, NVDA is struggling to read much after this occurs. |
|
I'm getting a lot of crashes when restarting binary versions of NVDA after this PR was merged with either [WinError 1400] Invalid window handle or [WinError 5] Access denied |
|
Link to issue number:
Closes #12238
Summary of the issue:
When restarting NVDA,
WM_QUITis posted as an event to the window, forcibly exiting the app. This leaves objects such as the system tray icon left behind.Additionally, changes introduced in #12183
gui.terminateno longer necessary/redundantDescription of how this pull request fixes the issue:
winUser.WM_EXIT_NVDAis registered that triggerssafeAppExitand can be called across instances of NVDA.safeAppExitso that it is exited properly before destructionsafeAppExitis not called fromgui.terminateif it has been called elsewhere to terminate the app.WM_QUITis the other way to exit the MainLoop other thansafeAppExitgui.terminateto process pending events as this doesn't work.Testing strategy:
nvda-old.logwhen restarting NVDA.Known issues with pull request:
When starting a new instance of NVDA with an existing instance running, where one is version
<2020.4, NVDA will not exit safely. Instead, the running NVDA copy will terminate directly using the behaviour of2020.4. This is becauseWM_EXIT_NVDAwon't be registered on the older instance.Issues with terminating NVDA across instances cannot be logged properly as the loghandler hasn't been initialized
Change log entry:
Developer changes
Code Review Checklist: