Nw.js: nw.App.quit() does nothing when app has no windows

Created on 13 Jan 2016  路  8Comments  路  Source: nwjs/nw.js

Appears in nwjs-sdk-v0.13.0-beta2-win-x64, probably others.
However, when I tried to reproduce this case in ubuntu, I've just ended up having app.js raw source code in window. Cant find issue for that and probably won't create some, because there are nothing particular in the docs about using *.js files as main entry point.
SO, the problem itself:
When using JS file as app.main and the code does not generate any window, there isn't possible to quit an application. Sample code follows.

// package.json:
{
  "name": "nwtst",
  "main": "app.js"
}

// app.js:
alert(Date.now());
nw.App.quit(); // well, process.exit(); just crashes nwjs at all

Expected result: show an alert, then have process ended.
Actual result: alert shown, but process persists in a task manager and application can't be launched again until nw process killed manually (well, single-instance can be set to false whilst this feature has been deprecated now; and it's not an option at all).
Workaround: after trying some various code samples (including process.exit();) I realized that it may be caused by something that waits for all of app's windows to be destroyed in App.quit(), but that code never hits just because nodody can generate those events at all. So, adding nw.Window.open('', { show: false }); somewhere in app makes it exit as expected.

bug nw13 test-todo

Most helpful comment

This issue appears to still exist for me in [email protected]. In an app that only has a tray, nw.App.quit(); had no effect until I added the w.Window.open('', { show: false }); workaround.

All 8 comments

I can confirm this bug with beta3.

fixed in git and will be available in the next nightly build.

Thanks.

This issue appears to still exist for me in [email protected]. In an app that only has a tray, nw.App.quit(); had no effect until I added the w.Window.open('', { show: false }); workaround.

Thanks your this issue, I also encountered this situation.

I can reproduce this with nwjs-sdk-v0.36.0-beta1-win-x64 (and nwjs-sdk-v0.35.5-win-x64).
I use the sample code above and the results and workaround are exactly the same as above.

I also have this problem on 0.35.5 SDK x64

still not fixed (0.36.1)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xland picture xland  路  3Comments

nawazishali picture nawazishali  路  3Comments

xzh-loop picture xzh-loop  路  3Comments

mmommo picture mmommo  路  4Comments

daverave1212 picture daverave1212  路  3Comments