question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App does not quit on Window.get().close(true) or App.quit() on macOS in some cases

See original GitHub issue

I’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

  1. start nwjs from sdk build
  2. open dev tools via right click + Inspect
  3. focus back on nwjs window
  4. 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

Screenshot 2019-11-19 12 16 00

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:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rogerwangcommented, Nov 23, 2019

Merged and will be available in the next nightly build.

1reaction
jtg-ggcommented, Nov 22, 2019

@rogerwang please accept my pull request https://github.com/nwjs/chromium.src/pull/144 for this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to force an app to quit on your Mac - Apple Support
To quit a Mac app normally, choose Quit from the app's menu in the menu bar, or press Command-Q. If the app doesn't...
Read more >
Why Does Closing Windows on a Mac not Quit the Application?
https://macmost.com/e-2856 When switching from Windows to Mac many people wonder why Mac apps don't quit when you click the red close button ...
Read more >
macos - How to close a window without the application quitting?
Some applications will still quit entirely when you use command ⌘ + W , such as Preview. You can usually rely on this...
Read more >
Getting Mac OS X applications to close after last window closed
If you want to quit and close all open windows of a program, just uncheck "Quit only when 1 window is left for...
Read more >
How to Force Quit on Mac - Parallels
On your keyboard, press and hold Command + Option + Esc. It will immediately bring up a “Force Quit Application” window. Select the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found