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

0.13.0-beta4 - app crash when closing window if package.window.show is false (MacOS) #4187

Closed
AndryBray opened this issue Jan 8, 2016 · 6 comments
Assignees

Comments

@AndryBray
Copy link

Same error #4114 (comment) but with beta3 and only if app is launched from zipped app.nw.

Maybe reopen this issue #4114?

@rogerwang rogerwang self-assigned this Jan 13, 2016
@rogerwang
Copy link
Member

@ghostoy pls add case for this.

@AndryBray
Copy link
Author

@rogerwang it should be the same as #4114

Try to package some app using this package.json

{
  "name": "myapp",
  "description": "my app",
  "version": "0.1.0",
  "main": "app.html",
  "window": {
    "icon": "icon.png",
    "show": false,
   "width": 1000,
    "height": 600,
    "min_width": 800,
    "min_height": 400,
    "position": "center"
   }
}

show: false was breaking my packaged app. I will test it again with beta4 and I'll let you know

@AndryBray
Copy link
Author

@rogerwang I found the problem.

It's not only related to the show parameter but there is a special test case to follow:

pacakge.json

{
  "name": "myapp",
  "description": "my app",
  "version": "0.1.0",
  "main": "app.html",
  "window": {
    "icon": "icon.png",
    "show": false,
   "width": 1000,
    "height": 600,
    "min_width": 800,
    "min_height": 400,
    "position": "center"
   }
}

splashscreen.html

<b>Just a splashscreen page with some image</b>

app.html (app.js included) <-- this window should be hidden as described in package

<script>
//bootstrap code
var _showSplashScreen = function () {
    return new Promise(function(resolve) {
        nw.Window.open('splashscreen.html', {
            'frame'         : false,
            'position'      : 'center',
            'always_on_top' : true,
            'width'         : 800,
            'height'               : 500,
            'show'          : false,
            //'toolbar'     : false,
            'focus'         : true,
            "icon"          : "icon.png"
        }, function(ssWin) {

            ssWin.on('loaded', function() {
                console.log('on ssWin loaded');
                ssWin.show();
                resolve(ssWin);
            });
        });
    });
};

//...
_showSplashScreen().then(function(w) {
    window.setTimeout(function() {
        w.close(); //here the app will crash
        w = null;

        //other code useless for test case

    }, 3000);
});
</script>

So the app will crash when starts with show:false, shows a window and close it.

@AndryBray AndryBray changed the title 0.13.0-beta3 - package window.show=false crash at boot - MacOS 10.10.5 0.13.0-beta4 - app crash when hiding window if package.window.show is false (MacOS) Jan 19, 2016
@AndryBray AndryBray changed the title 0.13.0-beta4 - app crash when hiding window if package.window.show is false (MacOS) 0.13.0-beta4 - app crash when closing window if package.window.show is false (MacOS) Jan 19, 2016
@AndryBray
Copy link
Author

I see this happens even if the package has window.show = true and I try to hide right after the main app window (app.html) like that

package.json => window: { show: true, .... } ...

var mainWin = nw.Window.get();
//let's hide the main app as first task
mainWin.hide();

//open the splashscreen
// here same code of previous comment

The app will crash anyway. So I think it's something related to the visibility of main app window.

@rogerwang Could you confirm?

@ghostoy
Copy link
Member

ghostoy commented Jan 19, 2016

It's mac only. And NW wasn't crashed, but quit the event loop after hidden window is closed. I will add a case for it.

ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 19, 2016
rogerwang added a commit that referenced this issue Jan 20, 2016
@rogerwang
Copy link
Member

Fixed and available in the last nightly build.

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

No branches or pull requests

3 participants