Skip to content

Commit ad079b5

Browse files
committed
Fix nwjs#486: should delete Shell object on native window destruction
Or the platform events will be sent, and then deleted Shell object is referred.
1 parent cc48f72 commit ad079b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api/app/app.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "base/message_loop.h"
2626
#include "base/values.h"
2727
#include "content/nw/src/api/api_messages.h"
28+
#include "content/nw/src/browser/native_window.h"
2829
#include "content/nw/src/browser/net_disk_cache_remover.h"
2930
#include "content/nw/src/nw_package.h"
3031
#include "content/nw/src/nw_shell.h"
@@ -131,7 +132,9 @@ void App::CloseAllWindows(bool force) {
131132
if (!windows[i]->is_devtools()) {
132133
// If there is no js object bound to the window, then just close.
133134
if (force || windows[i]->ShouldCloseWindow())
134-
delete windows[i];
135+
// we used to delete the Shell object here
136+
// but it should be deleted on native window destruction
137+
windows[i]->window()->Close();
135138
}
136139
}
137140
}

0 commit comments

Comments
 (0)