Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nw2: window.on('close') crash and missing callback string during cmd + Q (OSX) #7263

Closed
nvedamurthy opened this issue Dec 10, 2019 · 1 comment
Assignees

Comments

@nvedamurthy
Copy link

nvedamurthy commented Dec 10, 2019

#7230
NWJS Version : nightly build 0.43.0 built on 12/10/2019 - https://dl.nwjs.io/live-build/nw43/20191210-162000/8f8b6a467/v0.43.0/
Operating System : OSX 10.15.1

Expected behavior

with --disable-features=nw2 argument, I am able to get the string quit passed in the callback as per the documentation here when cmd + q is pressed
http://docs.nwjs.io/en/latest/References/Window/#event-close
Also the app doesn't quit or crash, when the following code is executed in developer tools

nw.Window.get(window).on('close', function(osx_quit) {
    return;
});

Actual behavior

When the above code is executed in the developer tools.
cmd + Q is pressed , the flag in the callback is undefined and the app crashes. Few processes are still running in the activity monitor. Need to force quit the application to completely close.

How to reproduce

Download the sdk version (nwjs-sdk-v0.43.0-osx-x64.zip), in the above mentioned nightly build. In the developer tools, execute the following code:

nw.Window.get(window).on('close', function(osx) {
    var fs = require('fs');
    fs.writeFileSync("/Users/foo/test.txt", osx, function(err) {
        if(err) {
            console.log(err);
        }
    });
})

Press cmd + Q.
The app crashes. The file has undefined written in it instead of quit.

@nvedamurthy nvedamurthy changed the title nw2: window.on('close') crash and missing callback string during cmd + q (OSX) nw2: window.on('close') crash and missing callback string during cmd + Q (OSX) Dec 10, 2019
@rogerwang rogerwang self-assigned this Dec 11, 2019
@rogerwang
Copy link
Member

Thanks for reporting. This is fixed in git and will be available in the next nightly build.

CC #7242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants