When app is terminate by SIGTERM or tizen.application...exit(),
There comes a TypeError 'Object has been destroyed'
suspend() will be called again on quit() for backgroun-runnable
apps, but since this.mainWindow can be already destroyed, below
code can throw exception with destroyed object 'this.mainWindow'
- addonManager.emit('lcSuspend', this.mainWindow.id);
It is enough to call setEnable() for suspending (if window is alive)
Change-Id: Ie2e99cf74ca412902e4456901dc8350f038e3067
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
if (this.suspended || this.inQuit)
return;
console.log('WebApplication : suspend');
- addonManager.emit('lcSuspend', this.mainWindow.id);
this.suspended = true;
- if (this.windowList.length > 0)
+ if (this.windowList.length > 0) {
+ addonManager.emit('lcSuspend', this.mainWindow.id);
this.windowList[this.windowList.length - 1].hide();
+ }
this.flushData();
if (this.profileDelegate.canIgnoreSuspend())
return;
quit() {
console.log('WebApplication : quit');
this.flushData();
- this.windowList.forEach((window) => window.removeAllListeners());
+ this.windowList.forEach((window) => {
+ window.removeAllListeners();
+ window.setEnabled(false);
+ });
this.inQuit = false;
- if (!this.suspended)
- this.suspend();
}
beforeQuit() {