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

does not exit the whole app #325

Closed
askie opened this Issue Jan 9, 2013 · 10 comments

Comments

Projects
None yet
5 participants
@askie

askie commented Jan 9, 2013

I'm using code to exit whole app

mainwin.on('close', function () {
    gui.App.closeAllWindows();
    gui.App.quit();
});

or

mainwin.on('close', function () {
    gui.App.quit();
});

but there are some hide windows still working on background

os win7
node-webkit v0.3.6
node.js v0.8.14

@owenc4a4

This comment has been minimized.

Show comment
Hide comment
@owenc4a4

owenc4a4 Jan 9, 2013

Contributor

It runs well in my computer.
And the test code

var gui = require('nw.gui');
var winmain = gui.Window.get();
var win1 = gui.Window.open('tt.html', {show : false});
var win2 = gui.Window.open('tt.html');

winmain.on('close', function(){
   gui.App.quit();
});
Contributor

owenc4a4 commented Jan 9, 2013

It runs well in my computer.
And the test code

var gui = require('nw.gui');
var winmain = gui.Window.get();
var win1 = gui.Window.open('tt.html', {show : false});
var win2 = gui.Window.open('tt.html');

winmain.on('close', function(){
   gui.App.quit();
});
@askie

This comment has been minimized.

Show comment
Hide comment
@askie

askie Jan 9, 2013

sometimes it exit normaly, but sometimes some hidden windows still working on background!

askie commented Jan 9, 2013

sometimes it exit normaly, but sometimes some hidden windows still working on background!

@Mithgol

This comment has been minimized.

Show comment
Hide comment
@Mithgol

Mithgol Jan 9, 2013

Contributor
gui.App.closeAllWindows();
gui.App.quit();

Wait, isn't gui.App.quit() enough? It should close all windows anyway.

Also, calling closeAllWindows() inside .on('close', …) callback implies that the callback should call itself (it closes the current window as well as the others, right)? Smells like an endless cycle. Maybe that's why the process continues running.

Try removing gui.App.closeAllWindows() from your code so that only gui.App.quit() remains in that place.

See if it fixes the issue.

Contributor

Mithgol commented Jan 9, 2013

gui.App.closeAllWindows();
gui.App.quit();

Wait, isn't gui.App.quit() enough? It should close all windows anyway.

Also, calling closeAllWindows() inside .on('close', …) callback implies that the callback should call itself (it closes the current window as well as the others, right)? Smells like an endless cycle. Maybe that's why the process continues running.

Try removing gui.App.closeAllWindows() from your code so that only gui.App.quit() remains in that place.

See if it fixes the issue.

@askie

This comment has been minimized.

Show comment
Hide comment
@askie

askie Jan 10, 2013

yes, I have trying

mainwin.on('close', function () {
    gui.App.quit();
});

sometimes some hidden windows still working on background.

askie commented Jan 10, 2013

yes, I have trying

mainwin.on('close', function () {
    gui.App.quit();
});

sometimes some hidden windows still working on background.

@rogerwang

This comment has been minimized.

Show comment
Hide comment
@rogerwang

rogerwang Jan 18, 2013

Member

what do you mean by hidden windows still working on background? How did you find that?

Member

rogerwang commented Jan 18, 2013

what do you mean by hidden windows still working on background? How did you find that?

@askie

This comment has been minimized.

Show comment
Hide comment
@askie

askie Jan 21, 2013

main widow have been closed ,but
cc
some hidden windows sitll working.

on main window close event

mainwin.on('close', function () {
    gui.App.quit();
});

askie commented Jan 21, 2013

main widow have been closed ,but
cc
some hidden windows sitll working.

on main window close event

mainwin.on('close', function () {
    gui.App.quit();
});
@owenc4a4

This comment has been minimized.

Show comment
Hide comment
@owenc4a4

owenc4a4 Jan 22, 2013

Contributor

Cloud you share your sample for us?

Contributor

owenc4a4 commented Jan 22, 2013

Cloud you share your sample for us?

@rogerwang

This comment has been minimized.

Show comment
Hide comment
@rogerwang

rogerwang Feb 7, 2013

Member

@askie, does the issue still happen on your side with the newest version and could you please provide a full case?

Member

rogerwang commented Feb 7, 2013

@askie, does the issue still happen on your side with the newest version and could you please provide a full case?

@askie

This comment has been minimized.

Show comment
Hide comment
@askie

askie Feb 7, 2013

newest version test my code, all are ok !

askie commented Feb 7, 2013

newest version test my code, all are ok !

@rogerwang rogerwang closed this Feb 7, 2013

@vivekgaikwad

This comment has been minimized.

Show comment
Hide comment
@vivekgaikwad

vivekgaikwad Jul 21, 2015

You can use below code to close all the running windows in the background:
var gui = require('nw.gui');
var win = gui.Window.get();

mainwin.on('close', function () {
gui.App.closeAllWindows();
win.close(true);
}
By the above all the windows running in the background will be closed and you can check task manager after that.

vivekgaikwad commented Jul 21, 2015

You can use below code to close all the running windows in the background:
var gui = require('nw.gui');
var win = gui.Window.get();

mainwin.on('close', function () {
gui.App.closeAllWindows();
win.close(true);
}
By the above all the windows running in the background will be closed and you can check task manager after that.

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