App does not quit on Window.get().close(true) or App.quit() on macOS in some cases
See original GitHub issueI’ve noticed this behavior on 0.42.x builds on macOS Catalina, not sure what version it was introduced in, but have not seen it in 0.39.x builds, have not tried reproducing it on older macOS either.
I’m going to describe how to reproduce something like this reliably with latest sdk build, but I’m still trying to figure out if I can get some minimalistic example on normal build and maybe I’m actually talking about two different defects here.
NWJS Version : 0.42.5 Operating System : macOS Catalina
Expected behavior
App should exit.
Actual behavior
App is hidden, can not be restored, but app icon shows app as running and chrome_crashpad_hander and app / GPU / Renderer helpers keep running.
How to reproduce
- start nwjs from sdk build
- open dev tools via right click + Inspect
- focus back on nwjs window
- press
⌘ + Q
after that nwjs and dev tools windows are closed and can not be opened, but app is still running, and it shows Hold ⌘ Q to Quit
message on top of screen if you try switch to the app, ignoring any events
After that it’s only possible to Force Quit
it, regular Quit
does not work.
If instead of ⌘ + Q
you do Quit nwjs
from nwjs menu it closes dev tools, but app keeps running and at that point it would not react to any form of quit command (Quit nwjs
from menu, Quit
on app icon, executing nw.App.quit()
or nw.Window.get().close(true)
in console if you re-open dev tools, which is possible in this case)
If I close dev tools before doing ⌘ + Q
it all works fine empty app.
In real app we periodically run into situation with 0.42.x builds when you do Window.get().close(true)
or App.quit()
after interacting with app for a while and everything gets closed, but app processes keep running.
The difference in this case is that if we click Quit
on app icon the app exits right away after that, no Force Quit
is necessary.
Unfortunately it’s not clear how to debug this scenario, as after Window.get().close(force)
or App.quit()
dev tools exit and can not be reopened.
My only idea is to try to trigger crash of the app right after calling win.close(true)
and app being stuck in that state, not sure though how to do that yet.
Actually, if you try those 4 steps on nwjs sdk build 0.42.3 then you Force Quit
is not required, just Quit
on app icon after that is enough. So, there is a chance that app not handling win.close(true)
has always been observed on sdk builds only and we just did not realize it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Merged and will be available in the next nightly build.
@rogerwang please accept my pull request https://github.com/nwjs/chromium.src/pull/144 for this issue